Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 3.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-22-2004, 06:34 AM   PM User | #1
camerch
New to the CF scene

 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
camerch is an unknown quantity at this point
Passing values to a form in an IFrame

Is it possible to pass variables to a input field in a form that is in an IFrame window?

I've tried:
Code:
 <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";

Code:
 <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!
camerch is offline   Reply With Quote
Old 09-22-2004, 07:44 AM   PM User | #2
hemebond
Senior Coder

 
Join Date: Jul 2004
Location: New Zealand
Posts: 1,315
Thanks: 0
Thanked 2 Times in 2 Posts
hemebond is an unknown quantity at this point
parent.html
Code:
<!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
Code:
<!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
hemebond is offline   Reply With Quote
Old 03-16-2006, 11:33 AM   PM User | #3
mic2100
Regular Coder

 
mic2100's Avatar
 
Join Date: Feb 2006
Location: Scunthorpe
Posts: 562
Thanks: 15
Thanked 28 Times in 27 Posts
mic2100 is on a distinguished road
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
mic2100 is offline   Reply With Quote
Old 03-16-2006, 11:50 AM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
that's simple:

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

is cross-browser.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:30 AM.


Advertisement
Log in to turn off these ads.