我是一个菜鸟,我做了一段代码,但老是出问题. 这个CASE是这样个的.就是我一点 "开始 "线的宽度就开始增加,一点 "停止 "就停止. 附代码如下:请高手帮忙. <html> <head> <meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 "> <title> Write The Codes By Myself </title> <script language= "javascript "> <!--hidden function cl() { this.timer=null; } cl.prototype.st=function(n){this.timer=window.setInterval( "this.add( ' "+n+ " ') ",100);} cl.prototype.add=function(n) { var obj=document.getElementById(n); obj.style.width=parseInt(obj.style.width)+10; } cl.prototype.stoped=function() { window.clearInterval(this.timer); } var my=new cl(); --> </script> </head> <body> <hr style= "width:10px " id= "line "> <form> <input type= "button " name= "Submit " value= "开始 " onClick= "javascript:my.st( 'line '); "> <input type= "button " name= "Submit2 " value= "停止 " onClick= "javascript:my.stoped(); "> </form> </body> </html> |