首页 > 其他 > 详细

setInterval 实时驱动界面改变

时间:2014-10-22 09:56:53      阅读:230      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 2 <html xmlns="http://www.w3.org/1999/xhtml"> 
 3 <head> 
 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
 5 <title>实时驱动界面改变</title> 
 6 <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> 
 7 </head> 
 8 <body> 
 9 输 入 值:<input type="text" id="inputValue" value="0" /> 
10 <br /> 
11 实时改变:<input type="text" id="inputChangeValue" value="0" /> 
12 </body> 
13 </html> 
14 <script type="text/javascript"> 
15 function setTxtValue() { 
16 var value = parseInt($("#inputValue").val()) 
17 $("#inputChangeValue").val(value) 
18 } 
19 var shTime; 
20 $(document).ready(function () { 
21 $("#inputValue").focus(function () { 
22 shTime = setInterval(setTxtValue, 100); 
23 }); 
24 $("#inputValue").blur(function () { 
25 clearInterval(shTime); 
26 }); 
27 }); 
28 </script> 

 


 

 

setInterval 实时驱动界面改变

原文:http://www.cnblogs.com/Orange-C/p/4042233.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!