Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Loading a new page in place a parent from an iframe


Loading a new page in place a parent from an iframe

Reply
  #1 (permalink)  
Old 07-14-05, 04:07 AM
Highly-Annoyed Highly-Annoyed is offline
Newbie Coder
 
Join Date: Jul 2005
Location: UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Loading a new page in place a parent from an iframe

Hello All!

I have a small problem I think you may be able to help with.

I have an iframe in a parent page. I want to put a link into the iframe, so when this link is “clicked” it loads a new page in place of the parent page.

So, page 1 has iframe 1 in it. A link in iframe 1 links to page 2. When the link is clicked, page 1 and its iframe (iframe1) disappear, to be replaced by page2.

I have managed to get the link in the iframe to open a new page outside of the iframe so far, but that page is opened in a new instance of Internet Explorer; like when you use target="_blank" on a normal link. What I really want is for the parent page to change to a new address. For example: from "www.mysite/page1.html" to "www.mysite/page2.html".

I have seen web sites that seem to do what I would like to do, so I know it’s possible. How it’s done though is something I don’t know.

I have built a few web sites in my life, but I have taught myself all the html I know and am not a professional in any sense of the word. My knowledge of Java Script is even more limited than my knowledge of html, so I would appreciate it if any solutions you guys come up with could be explained in simple-ish terms.

Thanks for you help !

Highly-Annoyed
Reply With Quote
  #2 (permalink)  
Old 07-14-05, 12:51 PM
sszettella sszettella is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
So I understand, you have 3 pages.

page 1 can look like this:
Code:
<html>
<head>
</head>
<body>
<iframe src="framed.html"></iframe>
</body>
</html>
Page 2 (framed.html) will have a link that, when clicked, will replace Page 1 like this:
Code:
<html>
<head>
</head>
<body>
<a href="page2.html" target="_top">changepage</a>
</body>
</html>
When the "changepage" link is clicked, page 1 should be replaced with page2.html. This works in IE 6 and Firefox 1.0, at the very least. All I have done is to set the target of the "framed" link to "_top".

Hopefully this helps.
__________________
Steve Szettella
4word systems
http://www.4wordsystems.com
http://szettella.blogspot.com
Reply With Quote
  #3 (permalink)  
Old 07-14-05, 01:46 PM
Highly-Annoyed Highly-Annoyed is offline
Newbie Coder
 
Join Date: Jul 2005
Location: UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Ok...

Hi sszettella,

That looks like a nice simple solution. Which is great, as that's exactly what I'm looking for. I will give it shot and see how it works out. I would guess you're probably correct, but if there are any problems, I'll post them here.

Thanks for your input!

Highly-Annoyed
Reply With Quote
  #4 (permalink)  
Old 07-18-05, 11:05 AM
Highly-Annoyed Highly-Annoyed is offline
Newbie Coder
 
Join Date: Jul 2005
Location: UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, that works perfectly...

Many thanks sszettella for your quick, easy to understand and correct response!

You have solved my problem. It seems so simple now I know, but before you showed me I tried loads of stuff that didn't work! Oh well, now I know. Thanks!

Highly-Annoyed
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
linking to both iframe content and parent page vman2957 HTML/XHTML/XML 5 12-02-06 12:49 AM
Background image for iframe same as main page riots HTML/XHTML/XML 6 02-17-06 11:22 AM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
Loading a new web page petrinjak PHP 9 11-01-04 09:57 PM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 08:44 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.