来源:远方网络 | 2006-12-1 | (有2539人读过)
<BR><SCRIPT language=JavaScript> <BR>var currentpos,timer; <BR><BR>function initialize() <BR>{ <BR>timer=setInterval("scrollwindow()",16); <BR>} <BR>function sc(){ <BR>clearInterval(timer); <BR>} <BR>function scrollwindow() <BR>{ <BR>currentpos=document.body.scrollTop; <BR>window.scroll(0,++currentpos); <BR>if (currentpos != document.body.scrollTop) <BR>sc(); <BR>} <BR>document.onmousedown=sc <BR>document.ondblclick=initialize<BR><BR>function runCode() //定义一个运行代码的函数,<BR><BR>{<BR> var code=event.srcElement.parentElement.children[0].value;//即要运行的代码。<BR> var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。<BR> newwin.opener = null // 防止代码对论谈页面修改<BR> newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。<BR> newwin.document.close();<BR><BR>}<BR></SCRIPT>
|