请大家帮我看看问什么不执行java script settimeout函数!!谢谢

[复制链接]
查看11 | 回复0 | 2009-1-30 06:28:38 | 显示全部楼层 |阅读模式
请大家帮我看看问什么不执行settimeout函数!!谢谢 <html> <head> <title>C</title> <script language="javascript"> function autogo(){ if (x<=1000){ x=x+50 c1.style.left=x setTimeout("autogo()",5) } } </script> </head> <body> <div ID="c1" STYLE="position:absolute;left:100;top:100;width:100;height:100;"> <img src="f:\\2210.gif"> </div> <a href="javascript:autogo()">autogo</a> </body> </html>

                                                                                                因为x没有定义:加上"var x=0"就可以了,即:<script language="javascript"> var x=0function autogo(){ if (x<=1000){ x=x+50 c1.style.left=x setTimeout("autogo()",5) } } </script> ok??^_^                                       
提问者对答案的评价:
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行