One, the simplest is the same page in the form of data transmission.
For example, there are two forms on a Web page, a text box in each form, and a button. The point button pairs each other to manipulate the value of each other's text box. The example we give is to pay a text box to another text box. The specific HTML code is as follows:
Copy Code code as follows:
<title>untitled document</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<form name= "Form1" method= "Post" action= "" >
<input type= "text" name= "TextField" >
<input type= "button" Name= "Submit" value= "1--------->2" onclick= "OK ()" >
</form>
<form name= "Form2" method= "POST" action= "" >
<input type= "text" name= "Textfield2" >
<input type= "button" Name= "Submit" value= "2----->1" onclick= "Ok1 ()" >
</form>
</body>
The above HTML code, you may notice the Onclik code, there are two functions, followed by the JavaScript code:
Copy Code code as follows:
<script language= "JavaScript" >
function ok ()
{
Document.form2.textfield2.value=document.form1.textfield.value;
}
function Ok1 ()
{
Document.form1.textfield.value=document.form2.textfield2.value;
}
</script>
Two, the second is data transfer between the text boxes of a form between two windows. In fact, this can be based on the original to carry out a number of extensions on it. about how to create pop-up windows, forms in the form of the code, here is not much to say, now here to say how to manipulate the parent window of the text box in the form of data. The specific code is as follows:
Copy Code code as follows:
<script language= "JavaScript" >
function ok ()
{
Opener.document.form2.textfield2.value=document.form1.textfield.value
}
</script>
Three, the third is the frame page between the form of the text box between the data transfer.
The place to note is the wording of the frame:
Copy Code code as follows:
<frameset cols= "505,505" >
<frame src= "test.htm" name= "Leftr" id= "Leftr" >//define the name of the frame
<frame src= "test2.htm" id= "right" name= "right" >
</frameset>
<noframes><body>
</body></noframes>
The specific implementation code is as follows:
Copy Code code as follows:
<script language= "JavaScript" >
function ok ()
{
Parent.leftr.document.form2.textfield2.value
=document.form1.textfield.value
}
</script>
The simple method of manipulating text box values between these three types of Windows is achieved, and the other thing to be aware of is their relationship.