...

View Full Version : Question - How to access a field on parent



zwassermann
01-31-2007, 08:35 PM
Hi,

I have the following:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Capital</title>
<script language="Javascript" type="text/javascript">
<!--
function btnSubmit1_onclick()
{
var s = document.getElementById("form1");
s = s.text1;
s = s.value;
alert("Post data! " + s);
}
//-->
</script>
</head>
<body>
<form action="" method="POST" id="form1" >
<p>When the checkbox is checked, you are prompted to enter a value</p>
<input type='text' id='text1' value='enter amt' maxlength='10' tabindex='1' />
<input type='button' id='btnSubmit1' value='Submit' onclick="btnSubmit1_onclick()" />
</form>

I want to put the value I get in a field on the page that opend this, how do I do that?

Thanks
Zack:confused:

zwassermann
01-31-2007, 10:04 PM
function btnSubmit1_onclick()
{
var s = document.form2.text1.value;

if(window.opener )
{
with(window.opener)
{
form1.testbox.value = s;
}
window.close();

}
else
{
// for DHTML :thumbsup:
top.document.form1.testbox.value = s;
top.document.getElementById("dwindow").style.display="none";
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum