Okay, I have a big javascript problem... I have an Inline Frame with option buttons, and I coded them so that whenever the selection is changed, a variable named i saves my value of that option button. Now I need to access this variable from the outside page, but don't know how to link to it.
So how do I access my variable in my Inline Frame, from the outside page, so I can use it in my script. Thx in advance. I added the code for the 2 pages (the main page and the inline frame) below.
-----------------------------------------------
MAIN PAGE
<html>
<body>
<script language="JavaScript">
<!--
function showMsg()
{
alert(window.testFrame.document.i);
}
// -->
</script>
<iframe name="testFrame" id="iFrame" src="testIframe.php">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
<form name="testForm" onSubmit="return false">
<input name="checkButton" type="button" value="Show Variable" onclick="showMsg()">
</form>
</body>
</html>
--------------------------------------
INLINE FRAME
<html>
<body>
<script language="JavaScript">
<!--
function whatVar()
{
for (var i = 0; i < document.numberForm.number.length; i++)
{
if (document.numberForm.number[i].checked)
{
i = i + 1;
break
}
}
}
// -->
</script>
Choose your option:
<form name="numberForm" onSubmit="return false">
<input selected name="number" type="radio" value="1" onclick="whatVar();">1<br>
<input name="number" type="radio" value="2" onclick="whatVar();">2<br>
<input name="number" type="radio" value="3" onclick="whatVar();">3<br>
</form>
</body>
</html>
So how do I access my variable in my Inline Frame, from the outside page, so I can use it in my script. Thx in advance. I added the code for the 2 pages (the main page and the inline frame) below.
-----------------------------------------------
MAIN PAGE
<html>
<body>
<script language="JavaScript">
<!--
function showMsg()
{
alert(window.testFrame.document.i);
}
// -->
</script>
<iframe name="testFrame" id="iFrame" src="testIframe.php">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
<form name="testForm" onSubmit="return false">
<input name="checkButton" type="button" value="Show Variable" onclick="showMsg()">
</form>
</body>
</html>
--------------------------------------
INLINE FRAME
<html>
<body>
<script language="JavaScript">
<!--
function whatVar()
{
for (var i = 0; i < document.numberForm.number.length; i++)
{
if (document.numberForm.number[i].checked)
{
i = i + 1;
break
}
}
}
// -->
</script>
Choose your option:
<form name="numberForm" onSubmit="return false">
<input selected name="number" type="radio" value="1" onclick="whatVar();">1<br>
<input name="number" type="radio" value="2" onclick="whatVar();">2<br>
<input name="number" type="radio" value="3" onclick="whatVar();">3<br>
</form>
</body>
</html>