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     <title>延时器</title>
 5     <style type="text/css">
 6         input
 7         {
 8             width: 500px;
 9         }
10     </style>
11     <script type="text/javascript">
12         onload = function () {
13             var timeoutId;
14             //在第一个框里输入内容,一秒后在第二个框里显示
15             text1.onkeyup = function () {
16                 clearTimeout(timeoutId);
17                 timeoutId = setTimeout(function () {
18                     text2.value = text1.value;
19                 }, 1000);
20 
21             }
22 
23         }
24     </script>
25 </head>
26 <body>
27     <input type="text" name="name" value=" " id="text1" /><br /><br /><br />
28     <input type="text" name="name" value=" " id="text2" />
29 </body>
30 </html>

 

相关文章:

  • 2021-07-01
  • 2021-09-14
  • 2022-12-23
  • 2021-04-21
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-11-19
  • 2021-12-09
相关资源
相似解决方案