Posts Tagged Accessing Other Frame Data
Accessing other frame data
Posted by in PHP code on July 29th, 2009
In your main page you have an iframe. The iframe code is:
<input type=”text” value=”andy” name=”myname”>
To access the data from that iframe the syntax will be :
Formname.document.getElementsByName.(‘contaolname’)[0].value
So the code for the main file is:
<script>
function getvalue()
{
alert(frame1.document.getElementsByName(‘myname’)[0].value);
}
</script>
<iframe src=”form.php” name=”frame1″></iframe>
function getvalue()
{
alert(frame1.document.getElementsByName(‘myname’)[0].value);
}
</script>
<iframe src=”form.php” name=”frame1″></iframe>
<input type=”button” value=”Get value” onclick=”getvalue()”>









