Javascript在文本框之间传递数据

时间:2018-02-24 14:55:13

标签: javascript parameter-passing

我正致力于使用javascript将数据从一个文本框转到另一个文本框。我是Javascript的新手,我得到一个文件未定义或null错误。

<!DOCTYPE html>
 <html>
  <head>
    <script>
      function doit() {
        window.document.form1.txtbox1.value= window.document.form2.txtbox2.value;
      }
   </script>
  </head>
 <body>

   <form name="form1">
     Enter your name:
     <input type="text" name="txtbox1" value="">
     <input type="button" name="btn1" value="Click" onclick="doit()">
   </form>

   <br><br><br>
   <form name="form2">
     Results: 
     <input type="text" name="txtbox2" value="">
   </form>

 </body>
</html>

0 个答案:

没有答案
相关问题