function array2table(tmpar,isLastPage)
{
//把tmpar里的数据填进tmptable中
//不考虑采用克隆节点的做法,而直接写innerHTML,以提高效率
//1 获得原表格的表头信息
//2 生成新的表格html var newTableHTML="<table cellpadding=1 style='font-size:15'>"+str;
for (var i=0;i<tmpar.length;i++)
{
var st ;
if (i%2 == 1)
st = "<tr>"
else
st = "<tr style='color:blue'>"
for (var j=0;j<tmpar[i].length;j++)
st += "<td align='right'>"+tmpar[i][j].innerText+"</td>"
st +="</tr>"
newTableHTML += st;
} if (isLastPage)
{
st = "<tr style='color:#8C8C8C'>"
for (var j=0;j<cols;j++) 
st += "<td align='right'>"+summary[j]+"</td>"
st +="</tr>"
newTableHTML += st;
}
newTableHTML +="</table>"
//3 写进表格的上层节点(div)中
return newTableHTML;;}function xml2array(st)
{
div1.innerHTML = "<table><tbody id=data>"+unescape(st)+ "</tbody></table>";
var tmpLines = data.children.length
for (var i=0;i<tmpLines;i++)
ar0[ar0.length]= data.children[i].children
return ;
}
function doPrint()
{tmpwindow=window.open("","","alwaysRaised=yes");
tmpwindow.document.write("<html><body>\n");
tmpwindow.document.write("<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0 VIEWASTEXT></OBJECT>\n");
tmpwindow.document.write("<center id='tools' >");
tmpwindow.document.write("<button onclick='pageSetup()'>页面设置</button>");
tmpwindow.document.write("&nbsp;<button onClick='preView()'>打印预览</button>");
tmpwindow.document.write("&nbsp;<button onclick='bigger()'>F↑</button>");
tmpwindow.document.write("&nbsp;<button onclick='smaller()'>F↓</button>");
tmpwindow.document.write("&nbsp;<button onclick='window.close()'>返回</button>");
tmpwindow.document.write("</center>\n");
tmpwindow.document.write("<center id='tips'><br><br>正在准备数据,请稍候……</center>\n");
tmpwindow.document.write("<center id='fileTitle' style='font-size:18' ondblclick='this.innerText=prompt(\"请输入新标题\",this.innerText)'>随机数</center><br>\n");
tmpwindow.document.write(array2table(ar,true));
tmpwindow.document.write("</body></html>\n");
tmpwindow.document.write("<script>\n");
tmpwindow.document.write("function pageSetup(){hide();WB.ExecWB(8,1);show()}\n");
tmpwindow.document.write("function preView(){hide();WB.ExecWB(7,1);show()}\n");
tmpwindow.document.write("function hide(){tools.style.display='none'}\n");
tmpwindow.document.write("function show(){tools.style.display=''}\n");
tmpwindow.document.write("function bigger(){");
tmpwindow.document.write("document.all.tags(\"table\")[0].style.fontSize = (parseFloat(document.all.tags(\"table\")[0].style.fontSize)*1.1)+\"px\"\n");
tmpwindow.document.write("fileTitle.style.fontSize=(parseFloat(document.all.tags(\"table\")[0].style.fontSize)*1.5)+\"px\" \n");
tmpwindow.document.write("}\n");
tmpwindow.document.write("function smaller(){");
tmpwindow.document.write("document.all.tags(\"table\")[0].style.fontSize = (parseFloat(document.all.tags(\"table\")[0].style.fontSize)/1.1)+\"px\"\n");
tmpwindow.document.write("fileTitle.style.fontSize=(parseFloat(document.all.tags(\"table\")[0].style.fontSize)*1.5)+\"px\" \n");
tmpwindow.document.write("}\n");
tmpwindow.document.write("tips.style.display='none'\n");
tmpwindow.document.write("<\/script>");}//-->
</SCRIPT></body>
</html>

解决方案 »

  1.   

    呵呵,是吗,问你个问题,你知道不知道iframe的滚动框,我有段代码,我把滚动框改成了链接,用onmouseover 和 onmouseout 来控制,当放在链接上时,就开始滚动!
    但我只会做右边的滚动,下边的滚动就不会了,你会吗?
    如果你没看明白我和你说的意思的话,那你给我你的信箱,我给你发我的代码过去
      

  2.   

    改好了。我觉得你要是真的“会做”右边的滚动,下边的就更容易了,看来你的基础不牢啊。不要太依赖ctrl-c、ctrl-v了。去找本奥莱利慢慢啃一个月吧。
      

  3.   

    你要的代码<html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>JS资源</title><style type="text/css">
    <!--
    .opacity {
    FILTER: alpha(opacity=100)
    }
    td,p,font{font-size:13px;}
    input{border: 1px #000000 solid; cursor: 默认;}
    .campo {  letter-spacing: 3px}
    .input1 {  border: 1px #000000 ridge; cursor: hand; height:17px}
    A{COLOR: #006790; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
    A:active {COLOR: #006790; FONT-FAMILY: 宋体; TEXT-DECORATION: underline overline}
    A:hover {COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: underline overline}
    BODY{FONT-FAMILY: 宋体; FONT-SIZE: 9pt;
    SCROLLBAR-HIGHLIGHT-COLOR: buttonface;
    SCROLLBAR-SHADOW-COLOR: buttonface;
    SCROLLBAR-3DLIGHT-COLOR: buttonhighlight;
    SCROLLBAR-TRACK-COLOR: #eeeeee;
    SCROLLBAR-DARKSHADOW-COLOR: buttonshadow}
    -->
    </style>
    <SCRIPT>
    function movstar(a,time){
    movx=setInterval("mov("+a+")",10)
    }
    function movover(){
    clearInterval(movx)
    }
    function mov(a){
    scrollx=new_date.document.body.scrollLeft
    scrolly=new_date.document.body.scrollTop
    scrolly=scrolly+a
    new_date.window.scroll(scrollx,scrolly)
    }
    function o_down(theobject){
    object=theobject
    while(object.filters.alpha.opacity>60){
    object.filters.alpha.opacity+=-10}
    }
    function o_up(theobject){
    object=theobject
    while(object.filters.alpha.opacity<100){
    object.filters.alpha.opacity+=10}
    }
    </SCRIPT><SCRIPT>
    //拷贝了两个函数,注意:scrolly=scrolly+a 被改成 scrollx=scrollx+a 了
    function movstar2(a,time){
    movx=setInterval("mov2("+a+")",10)
    }
    function movover2(){
    clearInterval(movx)
    }
    function mov2(a){
    scrollx=new_date.document.body.scrollLeft
    scrolly=new_date.document.body.scrollTop
    scrollx=scrollx+a
    new_date.window.scroll(scrollx,scrolly)
    }
    </SCRIPT>
    </head>
    <body bgcolor="#FFFFFF" >
    <form method=Get action='maintype.asp'>
      <div align="center"> 
        <table border="0" cellspacing="0" cellpadding="0" height="218" align="center">
          <tr> 
            <center>
              <td height="173" rowspan="3" valign="middle">&nbsp; </td>
            </center>
            <td height="161" width="300" rowspan="2" valign="middle" style="border: 1 solid #737373" colspan="3"> 
              <iframe 
          border=0 frameborder=0 framespacing=0 height=100% marginheight=0 
          marginwidth=0 name=new_date noResize scrolling=no 
          src="biaodan1.htm" width=100% vspale="0"> </iframe> </td>
            <center>
              <td height="1" width="10"><a href="javascript:void(0)" class=opacity  onMouseDown=movover();movstar(-3,2) 
          onMouseOut=movover();o_up(this) onMouseOver=movstar(-1,20);o_down(this) 
          onMouseUp=movover();movstar(-1,20)>up</a></td>
            </center>
          </tr>
          <tr> 
            <td height="163" width="10">&nbsp;</td>
          </tr>
          <tr> 
            <td height="12" width="10" valign="middle" style="border:0 solid #737373">
    <a href="javascript:void(0)" class=opacity  onMouseDown=movover2();movstar2(-3,2) 
          onMouseOut=movover2();o_up(this) onMouseOver=movstar2(-1,20);o_down(this) 
          onMouseUp=movover2();movstar2(-1,20)>left</a>
         </td>
            <td height="12" width="280" valign="middle" style="border:0 solid #737373">&nbsp;</td>
            <td height="12" width="10" valign="middle" style="border:0 solid #737373">
    <a href="###" class=opacity  
          onMouseDown=movover2();movstar2(3,2) onMouseOut=movover2();o_up(this) 
          onMouseOver=movstar2(1,20);o_down(this) onMouseUp=movover2();movstar2(1,20)>right</a>
    </td>
            <td height="12" width="10"><a href="###" class=opacity  
          onMouseDown=movover();movstar(3,2) onMouseOut=movover();o_up(this) 
          onMouseOver=movstar(1,20);o_down(this) onMouseUp=movover();movstar(1,20)>down</a></td>
          </tr>
        </table>
      </div>    
      </form>        
      </body>         
             
    </html>