Blackwave003
asked on
Getting Values From An Iframe In Javascript?
Ok, i am trying to do the following:
1) Once the page loads run the email() function
2) Delay getting values from Iframe (since it needs some time to load)
3) Get the "to" text value within the iframe form
4) Update the "to" value on the mainpage with the one from the iframe
5) Submit the form in the iframe
1) Once the page loads run the email() function
2) Delay getting values from Iframe (since it needs some time to load)
3) Get the "to" text value within the iframe form
4) Update the "to" value on the mainpage with the one from the iframe
5) Submit the form in the iframe
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TEst</title>
<script language="javascript">
function email()
{
document.getElementById('test').src="http://www.example.com/useremail.php?id=34";
setTimeout("getvalues()",5000);
}
function getvalues()
{
var to=window.frames['test'].document.forms[0].to.value;
}
</script>
</head>
<body onload="email();">
<form name="mainpage" id="mainpage">
<input type="hidden" name="to" value="" />
</form>
<iframe id="test" src="about:blank"></iframe>
</body>
</html>
====================
useremail.php
====================
The form in useremail is this
<form method="POST">
<input name="from" size="30" maxlength="35" type="text">
<input name="to" size="30" maxlength="35" type="text">
<input name="subject" size="60" maxlength="105" type="text">
<input type="submit"/>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Computer101
EE Admin