Forum Moderators: open

Message Too Old, No Replies

Link to IFRAME

How to redirect a link to an IFRAME.

         

Alfasys

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

10+ Year Member



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.

john_k

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

WebmasterWorld Senior Member 10+ Year Member



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>

Alfasys

7:49 am on Aug 13, 2004 (gmt 0)

10+ Year Member



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

ToneLeMoan

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

10+ Year Member



Hey Alfasys,

Change the troublesome line to this:

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

and it will work.

Alfasys

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

10+ Year Member



Hallo ToneLeMoan,

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

Thank you.

ToneLeMoan

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

10+ Year Member



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.