Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-22-2005, 01:50 AM   PM User | #1
Ranger56
Regular Coder

 
Ranger56's Avatar
 
Join Date: Mar 2005
Location: Kent, WA.
Posts: 783
Thanks: 0
Thanked 0 Times in 0 Posts
Ranger56 is an unknown quantity at this point
Help with loading in iframes.

What's the javascript to make links that are clicked in the navbar, open in the iframe?

Last edited by Ranger56; 03-22-2005 at 02:01 AM..
Ranger56 is offline   Reply With Quote
Old 03-22-2005, 02:04 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Can be done without javascript, just plain HTML.

<a href="thepage.html" target="nameOfTheIframe">link</a>
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-22-2005, 02:51 AM   PM User | #3
Ranger56
Regular Coder

 
Ranger56's Avatar
 
Join Date: Mar 2005
Location: Kent, WA.
Posts: 783
Thanks: 0
Thanked 0 Times in 0 Posts
Ranger56 is an unknown quantity at this point
For some reason, that wouldnt work for me, so I used,

Code:
		<script type="text/javascript">
		function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
    return false;
  }
  else return true;
}
then
Code:
<A HREF="url" TITLE="title" onclick="return loadIframe('frame', this.href)"><IMG ALT="alt" SRC="img.url" WIDTH="" BORDER="" HEIGHT=""></A>
Thanks anyways though.
Ranger56 is offline   Reply With Quote
Old 03-22-2005, 03:03 AM   PM User | #4
Scootertaj
Regular Coder

 
Join Date: Sep 2004
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Scootertaj is an unknown quantity at this point
Although it sounds like it worked, you might want to find a non-javascript alternative, as some ppl have javascript disabled and it will make your site look nothing like what it looks like for someone with javascript enabled
__________________
My Site
Scootertaj is offline   Reply With Quote
Old 03-22-2005, 04:05 AM   PM User | #5
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Quote:
Originally Posted by Ranger56
For some reason, that wouldnt work for me, so I used,
It should work. Did you specify the name (not the id) of the iframe in the target?

As Scootertaj mentioned, you should provide a non-javascript alternative as it can be disabled. And my suggested solution is the answer.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv 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 05:27 AM.


Advertisement
Log in to turn off these ads.