Welcome to WebmasterWorld Guest from 54.242.72.36

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

How can I open a link in an iframe?

     

wiredgear

10:14 pm on Mar 30, 2003 (gmt 0)

10+ Year Member



I am sorry for the noob question. :( I've been trying to figure this out and I just can't.

I have a menu for my new website design where you can choose a link to open a page. But I want these links to be opened in a iframe. Since I am horrible in english a bit, maybe a picture can tell you more of what I mean. <snip>

I am using Dreamweaver MX for the coding etc.

can someone help me out?

[edited by: Woz at 1:52 am (utc) on Mar. 31, 2003]
[edit reason] No URLs please [/edit]

felix

11:29 pm on Mar 30, 2003 (gmt 0)

10+ Year Member



I can't help you with dreamweaver, but I can show you the javascript. You will need something like this...

function show() {
document.getElementById('frame1').src="http://www.foo.com/"
}

...

<a href="javascript:show()">This opens www.foo.com in the iframe.</a>
<iframe id="frame1">Your browser does not support iframes. Too bad for you.</iframe>

This will work for DOM compliant browsers. Older and non-compiant browsers need to be handled individually as usual...

My best advice? I know you didn't ask, but I'm going to say it anyway. WYSIWYG tools are most useful when used together with a good understanding of the underlying code.

wiredgear

1:08 am on Mar 31, 2003 (gmt 0)

10+ Year Member



hey thx for the help but I have no idea what to do with the javascript. Where do I put it? As you can see, I am a html noob.

MWpro

1:40 am on Mar 31, 2003 (gmt 0)

10+ Year Member



Felix, what is the point of making things complicated with javascript? Especially for a beginner who is just asking for help...

Just give it a name or id, and use the target attribute within the <a href code.

example

<iframe name="namehere"....

<a href="linkhere.html" target="namehere">Link Text</a>

wiredgear

2:32 am on Mar 31, 2003 (gmt 0)

10+ Year Member



MWpro, thank you very much! I've been trying to do this for a while now. I really appreciate the help guys. Again, thx.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month