Welcome to WebmasterWorld Guest from 34.231.247.139

Forum Moderators: open

Message Too Old, No Replies

Link to IFRAME

How to redirect a link to an IFRAME.

     
3:53 pm on Aug 12, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Hallo,

I was wondering if it's possible to navigate a link to an IFRAME in following use.
I made a table out of 3 rows and 3 columns.

They are numbered as:

1 2 3
4 5 6
7 8 9

I would like to have a pull down menu in cell 2.
An IFRAME is situated in cell 5.

A link selected in the menu (cell 2) must be opened in cell 5 (IFRAME). Is this possible? And if so how?

Thank you.

4:21 pm on Aug 12, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 3, 2003
posts:792
votes: 0


This is untested, but it should be close to what you need:

<table>
<tr>
<td>1</td>
<td>
<select onchange="document.frames[cell5].document.location=this.options[this.selectedIndex].value;">
<option value="page1.html" selected>Page 1</option>
<option value="page2.html">Page 2</option>
<option value="page3.html">Page 3</option>
<option value="page4.html">Page 4</option>
</select>
</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td><iframe id="cell5" name="cell5" src="page1.html" width="300" height="200"></iframe></td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
7:49 am on Aug 13, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Thank you for the quick respons.
I tried to embed the code in the table, but I get every time a script error:

'document.frames[...].document' is nul or not an object

----------------------------------------------------------
Cell 2 content
----------------------------------------------------------
<tr>
<td width="100%">
<select onchange="document.frames[myframe].document.location=this.options[this.selectedIndex].value;">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page2</option>
<option value="page3.htm">Page3</option>
<option value="page4.htm">Page4</option>
</select>
</td>
</tr>
----------------------------------------------------------
.
.
.
----------------------------------------------------------
Cell 5 content
----------------------------------------------------------
<td width="700" height="500">
<iframe id="myframe" name="myframe" src="page1.htm" width="100%" height="100%" frameborder="0"></iframe>
</td>
----------------------------------------------------------

what is wrong or what do I wrong?

Thank you

8:41 am on Aug 13, 2004 (gmt 0)

New User

10+ Year Member

joined:July 28, 2004
posts:31
votes: 0


Hey Alfasys,

Change the troublesome line to this:

<select onchange="document.getElementById('cell5').src=this.options[this.selectedIndex].value;">

and it will work.

8:58 am on Aug 13, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Hallo ToneLeMoan,

thank you for the quick respons.
I changed the code and it just works perfect.

Thank you.

9:15 am on Aug 13, 2004 (gmt 0)

New User

10+ Year Member

joined:July 28, 2004
posts:31
votes: 0


You're very welcome. I'm sure there is another way of doing it using the actual .frame element but this way works just fine.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members