D
djdave
Pb with javascript.
I've a 'main.html' script containing an 'iframe.html' IFRAME.
The 'iframe.html' is containing a form.
My problem is that i'm unable to get form fields values. What's the
syntax ???
NB: the script has to be generic, because it has to work with any .html
(i may don't know form's name and iframe's name).
Thanks
=== MAIN.HTML ===
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252">
<title>main</title>
</head>
<body>
<iframe name="pub" width="200" height="100" src="iframe.html">
</iframe>
<script language="Javascript">
// HERE'S MY PROBLEM: IT DISPLAYS ANYTHING !!!
document.write(document.frames[0].document.forms[0].elements[0].value);
</script>
</body>
</html>
=== IFRAME.HTML ===
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
alink="#ff0000">
<form method="POST" action="x" name="formIFrame">
<input type="text" name="name2" value="value2">
<input type="submit" value="POST2">
</form>
</body>
</html>
I've a 'main.html' script containing an 'iframe.html' IFRAME.
The 'iframe.html' is containing a form.
My problem is that i'm unable to get form fields values. What's the
syntax ???
NB: the script has to be generic, because it has to work with any .html
(i may don't know form's name and iframe's name).
Thanks
=== MAIN.HTML ===
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252">
<title>main</title>
</head>
<body>
<iframe name="pub" width="200" height="100" src="iframe.html">
</iframe>
<script language="Javascript">
// HERE'S MY PROBLEM: IT DISPLAYS ANYTHING !!!
document.write(document.frames[0].document.forms[0].elements[0].value);
</script>
</body>
</html>
=== IFRAME.HTML ===
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
alink="#ff0000">
<form method="POST" action="x" name="formIFrame">
<input type="text" name="name2" value="value2">
<input type="submit" value="POST2">
</form>
</body>
</html>