problem: input values not recognized in dinamicly loaded IFRAMEs
here is the thing I have a parent window that has an IFRAME
I then load a diffrent page into the IFRAME that contains an input
when I try to access - iFrm.document.all["grid_name"].value
i get an error saying that - "value is null or not an object"
I tryed checking to make sure the page is fully loaded using:
document.readyState=="complete"
and it is loaded and completed
the weirdest thing is that when debugging the error I can see the value
in the debbuger
and after that I get the value alerted just fine
so how come I get an error ?????
parent.html:
<script>
function loadIframe()
{
var iDiv = document.getElementById("pannel1");
alert("iDiv.id = " + iDiv.id);
var iFrm = document.getElementById("ifrm");
//ByTagName("IFRAME")[0];
alert("iFrm.id = " + iFrm.id);
iFrm.src="child.html"; //ALSO WORKS:
location.href="child.html";
}
function showGridName()
{
var iFrm = document.getElementById("ifrm");
alert("iFrm.src = " + iFrm.src);
var gridName = iFrm.document.all["grid_name"].value;
alert("gridName");
}
</script>
</head>
<body>
<input type="button" value="load frame" onclick="loadIframe();">
<input type="button" value="grid name" onclick="showGridName();">
<div id="pannel1" name="pannel1">
<IFRAME id="ifrm" name="ifrm" src="blank.html" grid_name="grid2">
</IFRAME>
</div>
</body>
<html>
child.html - in IFRAME
<html><body>
<form name="frm" action="blank.html">
<input type="hidden" id="grid_name" name="grid_name">
<input type="submit" value="send">
</form>
</body><html>
blank.html in IFRAME:
<html><body>blank page</body><html>