...

View Full Version : Passing values to a form in an IFrame



camerch
09-22-2004, 07:34 AM
Is it possible to pass variables to a input field in a form that is in an IFrame window?

I've tried:

<div class="panel" id="PPpanel" align="center" style="display: none;">
<iframe align="middle" frameborder="0" id="PPpanelIframe" name="PPpanelIframe" scrolling="auto" src="http://www.attwireless.com/ocs" title="Window" width="100%" height="300"></iframe>
</div>

javascript: PPpanelIframe.LoginForm.min.value="attwireless";



<div class="panel" id="PPpanel" align="center" style="display: none;">
<iframe align="middle" frameborder="0" id="PPpanelIframe" name="PPpanelIframe" scrolling="auto" src="http://www.attwireless.com/ocs" title="Window" width="100%" height="300"></iframe>
</div>

var iframe = document.getElementById('PPpanelIframe');
var minUser = iframe.document.getElementById('WirelessNo');
var minPass = iframe.document.getElementById('Password');


Please if any can help I appreciate it greatly!

hemebond
09-22-2004, 08:44 AM
parent.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Parent</title>
</head>
<body>
<iframe id="iframe" src="child.html"></iframe>
<input type="button" value="Go" onclick="document.getElementById('iframe').contentDocument.getElementById('txt').value = 'test successful';">
</body>
</html>child.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Child</title>
</head>
<body>
<input id="txt" type="text">
</body>
</html>This works in Gecko browsers and Opera.

Gecko DOM Reference (http://www.mozilla.org/docs/dom/domref/)

mic2100
03-16-2006, 12:33 PM
can you get the same code as this to work in IE, i am trying to make a page that auto logs in another website by opening that page within a IFRAME

Kor
03-16-2006, 12:50 PM
that's simple:

document.getElementById('iframe').contentWindow.document.getElementById('txt').value = 'test successful';

is cross-browser.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum