Entry
Are there any way to access a form field in an IFRAME from the calling frame in Netscape6 ?
Aug 14th, 2003 18:54
Ronald Woods, Morten Høyseth,
This shouldn't be a problem, mate. Try this:
<html>
<head>
<script language="javascript"><!--
function getValueFromIFrame(p_frame, p_fieldname) {
var frame = document.getElementById(p_frame);
return (frame.contentDocument.forms[0].elements
[p_fieldname].value);
}
--></script>
</head>
<body bgcolor="#999999">
<iframe name="iframe" id="iframe" src="iframe.html" style="width:
400px; height: 300px;"></iframe><br>
<button onClick="alert(getValueFromIFrame
('iframe','field1'));">Pushme!</button>
</body>
</html>
OK I haven't tried in N6, but at least N7 can take it. Sorry I was a
bit late... ;)
Oh ... I almost forgot. For security reasons, the two documents must
reside on the same server/domain.