Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2011, 07:38 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Unhappy iframe issue

Hi,

I have 2 iframes on a web page.

In 1st iframe there is a BUTTON, On Button click new pages should open in both the iframes.

I tried using window.parent , but it doesn't work in firefox, chrome, IE 8.

Following is the code :-

Main Page

<body>
<iframe src="1.htm" name="MapFrame"></iframe>
<iframe src="1.htm" name="MapFrame1"></iframe>
</body>
</html>

1sr IFrame

<html>
<head>
<title>1 Level</title>
<script type="text/javascript">

function GoToParent()
{
window.parent.document.getElementById("MapFrame"). src = "1.htm";
window.parent.document.getElementById("MapFrame1") .src = "1.htm";
}
</script>
</head>
<body>
<div id="page_effect" style="display:none;">
<Button id="b1" type="button" value="CLICK ME" onClick="GoToParent()" />

</div>
</body>
</html>


Thank You....!!
 
Old January 13th, 2011, 10:01 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

names are *NOT* ids.

If you want to use document.getElementById() to refer to something, you must give it an ID. The name is of no consequence for getElementById().

So:
Code:
<body>
<iframe src="1.htm" name="MapFrame" id="MapFrame"></iframe>
<iframe src="1.htm" name="MapFrame1" id="MapFrame1"></iframe>
</body>
Now try your code.

[code]
The Following User Says Thank You to Old Pedant For This Useful Post:
anup.maverick (January 14th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
iFrame vs. cookie issue. leouser PHP How-To 1 November 21st, 2007 03:34 AM
how to get out from Iframe k.manisha ASP.NET 2.0 Professional 1 September 12th, 2007 12:20 PM
values from one iframe to another iframe URGENT raaj Beginning PHP 2 February 27th, 2007 12:19 PM
iframe rockon HTML Code Clinic 1 March 2nd, 2005 06:00 AM
IFRAME Issue babloo81 Javascript 7 March 17th, 2004 05:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.