2。 利用webbrouser的打印:
   <HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" VIEWASTEXT>
</OBJECT>
<META content="MSHTML 6.00.2600.0" name="GENERATOR">
</HEAD>
<BODY>
<INPUT onclick="document.all.WebBrowser.ExecWB(1,1)" type="button" value="打开" name="Button" ID="Button1">
<INPUT onclick="document.all.WebBrowser.ExecWB(2,1)" type="button" value="关闭所有" name="Button" ID="Button2">
<INPUT onclick="document.all.WebBrowser.ExecWB(4,1)" type="button" value="另存为" name="Button" ID="Button3">
<INPUT onclick="document.all.WebBrowser.ExecWB(6,1)" type="button" value="打印" name="Button" ID="Button4">
<INPUT onclick="document.all.WebBrowser.ExecWB(6,6)" type="button" value="直接打印" name="Button" ID="Button5">
<INPUT onclick="document.all.WebBrowser.ExecWB(8,1)" type="button" value="页面设置" name="Button" ID="Button6">
<INPUT onclick="document.all.WebBrowser.ExecWB(10,1)" type="button" value="属性" name="Button" ID="Button7">
<INPUT onclick="document.all.WebBrowser.ExecWB(17,1)" type="button" value="全选" name="Button" ID="Button8">
<INPUT onclick="document.all.WebBrowser.ExecWB(22,1)" type="button" value="刷新" name="Button" ID="Button9">
<INPUT onclick="document.all.WebBrowser.ExecWB(45,1)" type="button" value="关闭" name="Button" ID="Button10">
打印测试
</BODY>
</HTML>

解决方案 »

  1.   

    3。显示页面“另存为”:
        <a href="javascript:void(document.execCommand('SaveAs'))">Save As</a>4:如何实现将文本框内容复制到剪帖板功能
       <FORM name="copy" ID="Form1">
    <DIV align="center">
    <INPUT onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="到剪帖板" ID="Button1" NAME="Button1">
    </DIV>
    <!-- #BeginEditable "form" -->
    <textarea name="txt" rows="20" cols="75" wrap="VIRTUAL" ID="Textarea1">
    &  t;!-- Script Size:  1.78 KB --&gt;</textarea> 

    </FORM>
      

  2.   

    5。除去空格:
       <html>
    <head>
    <title></title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <script language=javascript>
    String.prototype.Trim = function()
    {
        return this.replace(/(^\s*)|(\s*$)/g, "");
    }
    String.prototype.LTrim = function()
    {
        return this.replace(/(^\s*)/g, "");
    }
    String.prototype.RTrim = function()
    {
        return this.replace(/(\s*$)/g, "");
    }
    var s = "         leading and trailing spaces    ";window.alert(s + " (" + s.length + ")");//s = s.Trim();
      s=s.LTrim();
    window.alert(s + " (" + s.length + ")");</script>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body>
    </body>
    </html>
      

  3.   

    多谢:hui_feng(盘桃2) ( 原因:连续回复不能超三次)
    6。编辑文字:<BODY><DIV ID="oDiv">里编辑文字这是班主的</DIV>
    <SCRIPT>
    <!--
    oDiv.contentEditable = true;
    // -->
    </SCRIPT></BODY>
    7. 页面最大小化:
      <body>
    <OBJECT id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <PARAM name="Command" value="Minimize">
    </OBJECT>
    <button onclick="min.Click()" ID="Button1">页面最小化</button>
    <OBJECT id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <PARAM name="Command" value="Maximize">
    </OBJECT>
    <button onclick="max.Click()" ID="Button2">页面最大化</button>
    </body>
    8。 选择的日期:
       <head>
    <title></title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script>
    function foption(N){
    var i,N,str,M;
    str="";
    for(i=1;i<=N;i++)
      {if(i<10) str="<option value='0"+i+"'>"+"0"+i+"</option>";
       else str="<option value='"+i+"'>"+i+"</option>";   
          document.write(str);
      }  
    }
    function changeri(){
    var nian,yue,ri;
    ri=31;
    yue=form1.selmonth .value ;
    if(yue=="04" || yue=="06" || yue=="09" || yue=="11")
      ri=30;
    if(yue=="02")
      {nian=form1.selyear.value;
      if((nian%4==0 && nian%100!=0) || nian%400==0)
         ri=29;
       else ri=28;   
      }
     flen=form1.selday .length ; 
     form1.selday.length =ri;
     i=flen+1;
     for(i;i<=ri;i++)
       {
        form1.selday .options(i-1).text=i;
        form1.selday .options(i-1).value=i;
       }
    }
    </script>
    </head>
    <body>
    <form name="form1" acrion="" method="post" ID="Form1"> 
     <select name="selyear" onchange="javascript:changeri();" ID="Select1">
             <script language="javascript">foption(12);</script>
            </select>年<select name="selmonth" onchange="javascript:changeri();" ID="Select2">
             <script language="javascript">foption(12);</script>
            </select>月<select name=selday ID="Select3">
             <div id=selday><script language="javascript">foption(31);</script></div>
            </select>日
    </form> 
    </body>
      

  4.   

    9。禁止下载图片:<a href="javascript:void(0)"  ><img src=copyright1.gif></a>  
       禁止右键:<script language=javascript>
     <!--
        function click()
        {
        if(event.button==2)
           alert('不能看我的秘密');
          
        }
        document.onmousedown=click;
     -->
    </script>
     10。 页面只能在单独的窗口中显示:
            if(top.location !=self.location )
           top.location=self.location ;
    11。  边框大大小
         <body>
    <table width=75%>
    <tr><td><div id=mdiv style="overflow:scroll;width:200;height:100"></div></td></tr>
     <tr><td><input  onclick="alert(mdiv.clientHeight)"  type=button value="clientheight" /></td>
     <td><input  onclick="alert(mdiv.clientWidth )"  type=button value="clientwidth" /></td></tr>
     <tr><td><input  onclick="alert( mdiv.offsetHeight)"  type=button value=" offsetHeight" /></td>
     <td><input  onclick="alert( mdiv.offsetHeight )" type=button  value="offsetHeight" /></td></tr>
    </table>
      

  5.   

    11event 对象
     属性 描述 
    Abstract 使用 event 对象获取高级流重定向器(ASX)文件中项目横幅的 Abstract 内容。 
    altKey 设置或获取 Alt 键的状态。 
    altLeft 设置或获取左 Alt 键的状态。 
    Banner 使用 event 对象获取高级流重定向器(ASX)文件中项目的 Banner 内容。 
    button 设置或获取用户所按的鼠标按钮。 
    cancelBubble 设置或获取当前事件是否要在事件句柄中向上冒泡。 
    clientX 设置或获取鼠标指针位置相对于窗口客户区域的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条。 
    clientY 设置或获取鼠标指针位置相对于窗口客户区域的 y 坐标,其中客户区域不包括窗口自身的控件和滚动条。 
    contentOverflow 获取表明文档处理当前 LayoutRect 对象后是否包含附加的内容。 
    ctrlKey 设置或获取 Ctrl 键的状态。 
    ctrlLeft 设置或获取左 Ctrl 键的状态。 
    dataFld 设置或获取 oncellchange 事件影响的数据列。 
    fromElement 设置或获取事件发生时激活或鼠标将要离开的对象。 
    keyCode 设置或获取与导致事件的按键关联的 Unicode 按键代码。 
    MoreInfo 通过 event 对象获取高级流重定向器(ASX)文件中项目横幅的 MoreInfo 内容。 
    nextPage 获取打印模板中下页的位置。 
    offsetX 设置或获取鼠标指针位置相对于触发事件的对象的 x 坐标。 
    offsetY 设置或获取鼠标指针位置相对于触发事件的对象的 y 坐标。 
    propertyName 设置或获取对象上发生更改的属性名称。 
    qualifier 设置或获取由数据源对象提供的数据成员的名称。 
    reason 设置或获取数据源对象的数据传输结果。 
    recordset 从数据源对象设置或获取对默认数据集的引用。 
    repeat 获取 onkeydown 事件是否正在重复。 
    returnValue 设置或获取事件的返回值。 
    saveType 当 oncontentsave 触发时获取剪贴板类型。 
    screenX 设置或获取获取鼠标指针位置相对于用户屏幕的 x 坐标。 
    screenY 设置或获取鼠标指针位置相对于用户屏幕的 y 坐标。 
    shiftKey 设置或获取 Shift 键的状态。 
    shiftLeft 设置或获取左 Shift 键的状态。 
    srcElement 设置或获取触发事件的对象。 
    srcFilter 设置或获取触发 onfilterchange 事件的滤镜对象。 
    srcUrn 获取触发事件的行为的统一资源名称(URN)。 
    toElement 设置或获取用户要将鼠标指针移动指向的对象的引用。 
    type 从 event 对象中获取事件名称。 
    wheelDelta 设置或获取滚轮按钮滚动的距离和方向。 
    x 设置或获取鼠标指针位置相对于父文档的 x 像素坐标。 
    y 设置或获取鼠标指针位置相对于父文档的 y 像素坐标。
      

  6.   

    12.客户端显示器分辨率?
        WindowHeight= window.screen.height
        WindowWidth= window.screen.width
      加滚动条:<div style="overflow:auto;width:400;height:400">
    </div>
    13。 对try的理解。(FROM CSDN)
    <script>
    try{
       x=y;   // Cause an error.
    }
    catch(e){   // Create local variable e.
       alert(e);   // Prints "[object Error]".
       alert(e.number & 0xFFFF);   // Prints 5009.
       alert(e.description);   // Prints "'y' is undefined".
    }
    </script>
    14.
      

  7.   

    14. 原贴为:
      http://expert.csdn.net/Expert/topic/1106/1106077.xml?temp=.4836389
       怎样屏蔽IE的快捷键:
     <script language="Javascript"><!--
    //屏蔽快捷键函数
    function KeyDown(){
    if ((window.event.altKey)&&
          ((window.event.keyCode==37)||   //屏蔽 Alt+ 方向键 ←
           (window.event.keyCode==39))){  //屏蔽 Alt+ 方向键 →
         event.returnValue=false;
         }
      if ((event.keyCode==8)  ||                 //屏蔽退格删除键
          (event.keyCode==116)||                 //屏蔽 F5 刷新键
          (event.ctrlKey && event.keyCode==82)){ //Ctrl + R
         event.keyCode=0;
         event.returnValue=false;
         }
      if ((event.ctrlKey)&&(event.keyCode==78))   //屏蔽 Ctrl+n
         event.returnValue=false;
      if ((event.shiftKey)&&(event.keyCode==121)) //屏蔽 shift+F10
         event.returnValue=false;
      if (window.event.srcElement.tagName == "A" && window.event.shiftKey) 
          window.event.returnValue = false;  //屏蔽 shift 加鼠标左键新开一网页
      if ((window.event.altKey)&&(window.event.keyCode==115)){ //屏蔽Alt+F4
          window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
          return false;}
      }
    // --></script>改<body>标签为<body onkeydown="KeyDown()">
    15。 推建收藏页:
    http://expert.csdn.net/Expert/topic/915/915867.xml?temp=.2880518
      

  8.   

    16 滚动条在最下面:
     <body onload="document.body.scrollTop = document.body.scrollHeight">
      右边滚动条控制左边的:
      <body><iframe id=a1 src="about:<p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>"></iframe>
    <iframe src="about:<body onscroll='parent.a1.window.scrollTo(0,document.body.scrollTop)'><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>"></iframe></body>
    17。检查数字或汉字:
         <body><input type=text onpaste="return false" onkeypress="a()" ID="Text1" NAME="Text1">数字<br/>
    <input type=text onpaste="return false" onkeypress="b()" ID="Text2" NAME="Text2">汉字<br/>
    <input type=text onpaste="return false" onkeypress="c()" ID="Text3" NAME="Text3">非汉字<br/>
    <script language=javascript>
    function a()
    {
      var k = window.event.keyCode;
      if (k < 48 || k > 57){
         alert("你输入的不是数字!")
         window.event.keyCode = 0 ;}
    }
    function b()
    {
      var k = window.event.keyCode;
      if (k < 255){
         alert("你输入的不是汉字!");
         window.event.keyCode = 0 ;}
    }
    function c()
    {  //有问题
      var k = window.event.keyCode;
      if (k > 255){
         alert("你输入了汉字!");
         window.event.keyCode = 0 ;}
    }
    </script></body>