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 08-10-2006, 01:42 PM   PM User | #1
canandaigua
New to the CF scene

 
Join Date: Jul 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
canandaigua is an unknown quantity at this point
Changing two iframes at once - problems

Greetings,

I'm trying to change two iframes at once, when the user clicks on one link. I'm working in Dreamweaver MX on a mac. The script initially works, but after acouple clicks it seems to go buggy and will only change iframe1 and not iframe2. Also, the script won't work at all unless I define the iframes with an initial scr. (It won't let me use "" as the initial scr, so I'm using blank.jpg which is an image of a white colored pixel.) Any help will be appreciated. Thanks.

<code>

<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="106" rowspan="2"><img src="../Sbrush.jpg" width="101" height="480" /></td>
<td width="224" rowspan="2"><span class="style4">Brochures<br />
Please select a Title</span>
<ul>
<li><a href="javascript:void(0)" onClick="parent.iframe2.location='../blank2.jpg';parent.iframe1.location='JPGs/PelicanV3.jpg';return false">Pelican's Nest</a></li>
<li><a href="javascript:void(0)" onClick="parent.iframe2.location='TextR.htm';parent.iframe1.location='JPGs/RavenV4.jpg';return false">Ravenwood</a></li>
<li><a href="javascript:void(0)" onClick="parent.iframe1.location='JPGs/CampBayView.jpg';parent.iframe2.location='../blank.jpg';return false">YMCA Camp Bay View</a></li>
<li><a href="javascript:void(0)" onClick="parent.iframe1.location='JPGs/CampCory.jpg';parent.iframe2.location='../blank.jpg';return false">YMCA Camp Cory</a></li>
<li><a href="javascript:void(0)" onClick="parent.iframe1.location='JPGs/CampGorham.jpg';parent.iframe2.location='../blank.jpg';return false">YMCA Camp Gorham</a></li>
<li><a href="javascript:void(0)" onClick="parent.iframe1.location='JPGs/CampMonroe.jpg';parent.iframe2.location='../blank.jpg';return false">YMCA Camp Monroe</a></li>
</ul>
</td>
<td width="450" height="400"><iframe src="../blank.jpg" name="iframe1" width="450" marginwidth="0" height="420" marginheight="0" align="top" scrolling="Auto" frameborder="0" id="iframe1"><!-- iframe1 --></iframe>
<p>&nbsp; </p>
</td>
</tr>
<tr>
<td><iframe src="../blank.jpg" name="iframe2" width="300" marginwidth="0" height="40" marginheight="0" align="left" scrolling="No" frameborder="0" id="iframe2">
<!-- iframe2 -->
</iframe></td>
</tr>
</table>
</code>
canandaigua is offline   Reply With Quote
Old 08-10-2006, 03:18 PM   PM User | #2
vwphillips
Senior Coder

 
Join Date: Mar 2005
Location: Portsmouth UK
Posts: 4,354
Thanks: 3
Thanked 458 Times in 445 Posts
vwphillips is a jewel in the roughvwphillips is a jewel in the roughvwphillips is a jewel in the rough
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
</head>

<body>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="106" rowspan="2"><img src="../Sbrush.jpg" width="101" height="480" /></td>
<td width="224" rowspan="2"><span class="style4">Brochures<br />
Please select a Title</span>
<ul>
<li><a href="javascript:void(0)" onClick="document.getElementById('iframe2').src='http://www.vicsjavascripts.org.uk/StdImages/One.gif';document.getElementById('iframe1').src='http://www.vicsjavascripts.org.uk/StdImages/Two.gif';return false">Pelican's Nest</a></li>
<li><a href="javascript:void(0)" onClick="document.getElementById('iframe2').src='http://www.vicsjavascripts.org.uk/StdImages/Three.gif';document.getElementById('iframe1').src='http://www.vicsjavascripts.org.uk/StdImages/Four.gif';return false">Pelican's Nest</a></li>
<li><a href="javascript:void(0)" onClick="document.getElementById('iframe2').src='http://www.vicsjavascripts.org.uk/StdImages/Five.gif';document.getElementById('iframe1').src='http://www.vicsjavascripts.org.uk/StdImages/Six.gif';return false">Pelican's Nest</a></li>
<li><a href="javascript:void(0)" onClick="document.getElementById('iframe2').src='http://www.vicsjavascripts.org.uk/StdImages/Seven.gif';document.getElementById('iframe1').src='http://www.vicsjavascripts.org.uk/StdImages/Seven.gif';return false">Pelican's Nest</a></li>
</ul>
</td>
<td width="450" height="400">
<iframe src="../blank.jpg" id="iframe1" name="iframe1" width="450" marginwidth="0" height="420" marginheight="0" align="top" scrolling="Auto" frameborder="0" id="iframe1"><!-- iframe1 --></iframe>
<p>&nbsp; </p>
</td>
</tr>
<tr>
<td><iframe src="../blank.jpg" id="iframe2" name="iframe2" width="300" marginwidth="0" height="40" marginheight="0" align="left" scrolling="No" frameborder="0" id="iframe2">
<!-- iframe2 -->
</iframe></td>
</tr>
</table>
</code></body>

</html>
__________________
Vic

God Loves You and will never love you less.

http://www.vicsjavascripts.org.uk/

If my post has been useful please donate to http://www.operationsmile.org.uk/
vwphillips is offline   Reply With Quote
Old 08-10-2006, 03:44 PM   PM User | #3
canandaigua
New to the CF scene

 
Join Date: Jul 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
canandaigua is an unknown quantity at this point
It Works

Fabulous! Thanks so much.
canandaigua 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 04:34 PM.


Advertisement
Log in to turn off these ads.