我在网页中插入了一张图片,然后移动整个网页窗口,同时图片有一个双击事件,现在的问题是,在移动窗口的同时,要是鼠标点击了图片,就会出现脚本提示信息,请大家办我看看,要如何解决;代码如下:
<script language="javascript">
<!--
var t;
window.resizeTo(200,100);   //重新设置窗口大小
window.moveTo(0,300);     //移动窗口到起始位置function moveWin()
{
     window.moveBy(100,0);  //横向移动窗口
    if(window.screenLeft>=(screen.availWidth -300))     //一直到窗口位于屏幕右方就停止
       {
              window.clearInterval(t);
       }
}function intervalID()
{
       t = setInterval(moveWin,100);    //每隔100毫秒执行移动事件
}function OpenW()
{
     window.open("http://www.baidu.com");
}
//-->
</script>
<body onLoad="intervalID()">
<img src=".gif" onDblClick="OpenW()" />
</body>

解决方案 »

  1.   

    举个例子:点击向下按钮时窗口向下移动,在移动的过程中鼠标点击其他空白处,则会有脚本错误(左下角有提示)如何解决啊?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <script>
      var xx
      var v=1
      
      function ml() {
      clearTimeout(xx)
      window.moveBy(-v, 0);
      xx = setTimeout("ml()",140)
      }
      function mr() {
      clearTimeout(xx)
      window.moveBy(v, 0);
      xx = setTimeout("mr()",140)
      }
      function mu() {
      clearTimeout(xx)
      window.moveBy(0, -v);
      xx = setTimeout("mu()",140)
      }
      function md() {
      clearTimeout(xx)
      window.moveBy(0, v);
      xx = setTimeout("md()",140)
      }
      function ws(){
      clearTimeout(xx)
      }
      function adj(i)
           {
             if (i==1)
                  {
                         v+=1; 
                         if (v>5)v-=1
                  }
             else 
                  {
                         v-=1
                    if (v==0)v=1
                  }
      }
      </script>
      <DIV align=center>
      <FORM>
       <INPUT onclick=mu(v,0); type=button value=向上>
       
       <INPUT onclick=ml(v,0); type=button value=向左>
       
       <INPUT onclick=mr(0,v); type=button value=向右>
       
       <INPUT onclick=md(0,v); type=button value=向下>
       
       <INPUT onclick=ws(); type=button value=停止>
       <BR><BR><BR>
       <INPUT onclick=adj(1); type=button value=加速> 
       <INPUT onclick=adj(0); type=button value=减速>
       <BR></FORM></DIV></body>
    </html>
      

  2.   

    程序在窗口移动的过程中不点击鼠标网页左下方是没有脚步错误提示的,但是只要点击了鼠标就会有脚步错误,因为window.moveBy()还没有执行完,所以会提示脚本是否继续,我是想是否能在窗口移动的过程中窗口禁止捕获鼠标事件,这样就不会有问题了!
    高手指点一下啊!