Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change input value in 2nd window

Status
Not open for further replies.

askey

Programmer
Jun 9, 2002
5
DE
Hello everybody!

I tried to automatically change the value of an <input> (in a 2nd htm-file) while loading the 1st one, but it doesn't work.

function test()
{
window.open(&quot;url-of-the-2nd-htm-file&quot;,&quot;window&quot;);
document.all.in_one.value = &quot;3&quot;;
}

I have a htm-file with onLoad=&quot;test()&quot; in the body tag and in the second htm-file the input-field named &quot;in_one&quot; definitly exists. I don't know why it doesn't work.

Thanks in advance.
askey
 
Hi askey

Is this what yhou want?:
main page
Code:
<html>
<head>
<title></title>
<script type=&quot;text/javascript&quot; language=&quot;javascript&quot;>
function test(){
var win = window.open(&quot;page1.htm&quot;,&quot;window&quot;);
win.onload = win.document.frm.in_one.value = &quot;3&quot;;
}
</script>
</head>
<body onload=&quot;test()&quot;>
<p>&nbsp;</p>
</body>
</html>
page1.htm
Code:
<html>
<head>
<title></title>
</head>
<body>
<form action=&quot;&quot; method=post id=&quot;frm&quot; name=&quot;frm&quot;>
<input type=&quot;text&quot; id=&quot;in_one&quot; name=&quot;in_one&quot;>
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top