Click to See Complete Forum and Search --> : linking regular text into iframes


Miles
06-18-2004, 03:42 AM
I know how to link drop down menus to iframes however im not sure how to link regular text into my iframe

<A HREF="site index.htm">site
index</A>

i want to link that to my iframe

id='iframe'

Thanks

Miles

Pittimann
06-18-2004, 03:54 AM
Hi!

One way for that would be to also assign a name to your iframe and add a target="nameOfYourIframe" to your anchor tag; replacing nameOfYourIframe with the actual name of the iframe.

Cheers - Pit

Miles
06-18-2004, 04:01 AM
the name of my iframe is 'iframe'

would it be;

<A HREF="site index.htm" target="iframe">site
index</A>

cheers

Miles
06-18-2004, 04:16 AM
???

Pittimann
06-18-2004, 04:19 AM
Hi!???How difficult would that be to simply try it out?

Cheers - Pit

Miles
06-18-2004, 04:23 AM
oh i had it was more this is what i tried it didnt work what would i have to do!

sorry man

Pittimann
06-18-2004, 04:33 AM
Hi!

Sorry, but I don't understand what you want to say with your latest post.

In your first post you said: id='iframe'

I said: assign a name to your iframe
That means, your iframe will need an attribute name='iframe'

If that is done, <A HREF="site index.htm" target="iframe">site
index</A> will work

Cheers - Pit

Miles
06-18-2004, 04:37 AM
cheers ill have another go!

in my <iframe> i only have id='iframe' isnt that the same as 'name' if not do i have to have a name attribute aswell?

thanks alot

Pittimann
06-18-2004, 04:41 AM
Hi!do i have to have a name attribute aswell?For the third time: YES!

You can leave the id in your tag as well if you need it for different purposes...

Cheers - Pit

Miles
06-18-2004, 04:43 AM
thanks sorry

Miles

Pittimann
06-18-2004, 04:46 AM
No problem! :)

Cheers - Pit

Kor
06-18-2004, 05:15 AM
Pittman already gave you the answer, but as you asked me to detail it, ok

you may open a page in iframe using different methods. First using name

1. the simpliest is a pure HTML one

<a href="newpage.html" target="ifr">open newpage</a>
<iframe src="oldppage.html" name="ifr"></iframe>

2. using window.open() and onclick event handler

<a href="#" onclick="window.open('newpage.html','ifr');return false">open newpage</a>
<iframe src="oldppage.html" name="ifr"></iframe>

3. using getElementByName(name) and setAttribute() methods and onclick event handler

<a href="#" onclick="document.getElementByName('ifr').setAttribute('src','newpage.html');return false">open newpage</a>
<iframe src="oldppage.html" name="ifr"></iframe>

4. using getElementByName(name) and src attribute and onclick event handler

<a href="#" onclick="document.getElementByName('ifr').src='newpage.html');return false">open newpage</a>
<iframe src="oldppage.html" name="ifr"></iframe>

And the equivalents using id instead of name

5. using getElementById(id) and setAttribute() methods and onclick event handler

<a href="#" onclick="document.getElementById('ifr').setAttribute('src','newpage.html');return false">open newpage</a>
<iframe src="oldppage.html" id="ifr"></iframe>

6. using getElementById(id) and src attribute and onclick event handler

<a href="#" onclick="document.getElementById('ifr').src='newpage.html');return false">open newpage</a>
<iframe src="oldppage.html" id="ifr"></iframe>

Kor
06-18-2004, 05:20 AM
remove the red colored bracket, mistapeing, sorry

document.getElementByName('ifr').src='newpage.html')
should be
document.getElementByName('ifr').src='newpage.html'

the same

document.getElementById('ifr').src='newpage.html')
should be
document.getElementById('ifr').src='newpage.html'

Miles
06-18-2004, 05:51 AM
Cheers sorry he hadnt when i asked

Miles

Pittimann
06-18-2004, 09:49 AM
Hi!

I posted that at 10:54 AM my local time:Originally posted by Pittimann
One way for that would be to also assign a name to your iframe and add a target="nameOfYourIframe" to your anchor tag; replacing nameOfYourIframe with the actual name of the iframe.You asked Kor at 11:34 AM my local time.Originally posted by
Pittman already gave you the answerA part of your reply to Kor:he hadnt when i askedSorry but it is not my fault if you did not understand my reply; I think it exactly said, what you need to do... :rolleyes:

Cheers - Pit

Miles
06-18-2004, 10:00 AM
i asked you first but hadnt understood when i asked Kor!

Who cares i know now!

Thanks

Miles

Pittimann
06-18-2004, 10:02 AM
Hi!

Thanks to Kor, you even know more than one way how to do it. :D

Good luck & cheers - Pit

Miles
06-18-2004, 10:09 AM
yep gd man