IE5.0运行出现:IEXPLORE 在 017f:70bd4dcf 的模块 SHLWAPI.DLL 中导致堆栈错误然后窗口关闭.

解决方案 »

  1.   

    setTimeout(changeImg(),4); //你0.004秒就换一次图片吖???那一秒钟要换几次???1000/4=250次. setTimeout(prog,mm)这里mm的单位是毫秒吖
      

  2.   

    setTimeout(changeImg(),4);
    改为
    setTimeout(changeImg(),4*1000);//每4秒钟执行一次
      

  3.   

    ...........
    改为setTimeout(changeImg(),4*1000);也是一样显示内存不够
      

  4.   

    对setTimeout的一点理解:
    MSDN中说:
    In versions earlier than Microsoft® Internet Explorer 5, the first argument of setTimeout must be a string. Evaluation of the string is deferred until the specified interval elapses.
    As of Internet Explorer 5, the first argument of setTimeout can be a string or a function pointer.IE5以上,第一个参数可以是string或者是函数指针.
    所以上面的程序改为这样就可以了:
    <html>
    <head>
    <script>function changeImg()
    {
    var p1=Math.ceil(Math.random()*10);
    //alert(p1);
    document.getElementById("idImg1").src="img/"+p1+".jpg";
    setTimeout("changeImg()",4000);
    }
    </script>
    </head>
    <body>
    <table><img id="idImg1" height=180 width=240></table>
    <script>
    changeImg();
    </script>
    </body></html>
      

  5.   

    或者是这样
    <html>
    <head>
    <script>function changeImg()
    {
    var p1=Math.ceil(Math.random()*10);
    //alert(p1);
    document.getElementById("idImg1").src="img/"+p1+".jpg";
    setTimeout(changeImg,4000);//这里改为函数指针.
    }
    </script>
    </head>
    <body>
    <table><img id="idImg1" height=180 width=240></table>
    <script>
    changeImg();
    </script>
    </body></html>
    不知我这样理解有没有错呢。请高人指点...
      

  6.   

    呵呵其实setTimeout并不能真的精确到毫秒,不过楼主这么设置绝对就是要电脑死机啊,因为显示图片是比较耗资源的
      

  7.   

    img1=new Array(10);
    img1[0]="img/"+1+".jpg";
    img1[1]="img/"+2+".jpg";
    img1[2]="img/"+3+".jpg";
    img1[3]="img/"+4+".jpg";
    img1[4]="img/"+5+".jpg";
    img1[5]="img/"+6+".jpg";
    img1[6]="img/"+7+".jpg";
    img1[7]="img/"+8+".jpg";
    img1[8]="img/"+9+".jpg";
    img1[9]="img/"+10+".jpg";function changeImg()
    {
    var p1=Math.ceil(Math.random()*10);
    idImg1.src=img1[p1];
    setTimeout(changeImg(),4);
    }
      

  8.   

    to pxjianke(一无所有-光明唧),
    你上面的
    setTimeout(changeImg(),4);是错了。
    应该写成setTimeout('changeImg()',4000)不然会报错“内存不足”,因为setTimeout(changeImg(),4)这句首先会立即调用changeImg(),而不是过4 时间才调用.
    还有,你用数组去代替的只是图像路径的字符串组,并不是load 图像.
      

  9.   

    Scarroot正解!function   changeImg() 

    changeImg()

    就算chrome都執行不到