In fact, the principle is very simple. Also first, the Type property is GetAttribute, and the button is captured. Then, when the button is onclick, I pass through the URL to the child page.
Copy Code code as follows:
<input type= "text"/><input type= "Submit"/>
<input type= "text"/><input type= "Submit"/>
<script type= "Text/javascript" ><!--
var ainput = document.getelementsbytagname ("input");
for (i = 0; i < ainput.length; i++)
{
(
function (i) {
if (Ainput[i].getattribute ("type") = = "Submit")
{
Ainput[i].onclick = function () {
window.open (' b.html? ') +i, ' NewWindow ', ' height=100,width=400 ')
}
}
}
) (i)
}
--></script>
Sub-pages use the slice method to slice URLs. and use the Window.opener method to capture the text box of the parent page and assign the value. Everything's OK.
Copy Code code as follows:
<input type= "text"/><input type= "Submit"/>
<script type= "Text/javascript" ><!--
var ainput = document.getelementsbytagname ("input");
for (i = 0; i < ainput.length; i++)
{
if (Ainput[i].getattribute ("type") = = "Text") var textboxb = new Object (ainput[i));
if (Ainput[i].getattribute ("type") = = "Submit") var BTNB = new Object (ainput[i));
}
Btnb.onclick = function () {
var stextvalue = Textboxb.value
var ainput = window.opener.document.getElementsByTagName ("input");
var surl = document.location;
var sNo = surl.tostring (). Slice (-1)
window.opener.ainput[sno-"1"].value = Stextvalue
Window.close ();
}
--></script>
A friend who doesn't get it, just look at the schematics.