...

View Full Version : ONCLICK ..... display new image in specific DIV



Paul Williams
12-08-2011, 08:53 PM
from my spry sub.menu tab,
i'm trying to use "onclick" to post a new img in a specific div elsewhere on the page.

<li><a class="MenuBarItemSubmenu" href="#">CPQC</a>
<ul>
<li><a href="#" onclick="document.getElementById('cpqcRange').src='images/cpqc/cpqcHot.png';">Hot</a></li>
</ul>
</li>

<div id="cpqcRange">
<p>
<img src="cpqcLocation.png" alt="cpqcLocation" name="cpqcLocation" width="504" height="360" id="cpqcLocation" />
</p>
</div>

i think i'm close, but something is wrong.
can you just call up the div "cpqcRange" by name and slap a new img.src in there???????

cheers,
Paul

today's weather in Kalispell, MT, USA
cold, brrrrr, not much snow, but it's coming soon
it was about 18degF this morning

sunfighter
12-09-2011, 06:51 AM
Change the id to the img:


<a href="#" onclick="document.getElementById('cpqcRange').src='mages/cpqc/cpqcHot.png';">Hot</a>

<div >
<img id="cpqcRange" src="cpqcLocation.png" alt="cpqcLocation" name="cpqcLocation" width="140" height="240" id="cpqcLocation" />
</div>

Paul Williams
12-09-2011, 09:53 PM
thank you Sunfighter,

it worked great !!!!

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum