Webmaster Forum
Go Back   Webmaster forum » ..:: Web Design ::.. » Script

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 17-07-2009
pali pali is offline
Senior Member
 
Join Date: Jul 2009
Posts: 318
iTrader: (0)
pali is on a distinguished road
Default How to select an element by id and swapping an image ?

How to select an element by id and swapping an image ? ...
<script language="JavaScript" type="text/javascript" >
function setBeerIcon() {

var beerIcon = document.getElementById("beerIcon");
beerIcon.src = "images/"+getSelectValue("beer")+".jpg";
}
</script>

...

<img border="0" src="" id="brandIcon" alt="brand" />

<select name="beer" id="beer" onChange="setButton();setBeerIcon();">
<option value="--Select--">Select beer</option>
<option value="heineken">heineken</option>
<option value="sol">sol</option>
<option value="amstellight">amstellight</option>
<option value="coronalight">coronalight</option>
<option value="coronaextra">coronaextra</option>
<option value=""></option>
</select>
Reply With Quote
 

Bookmarks

Thread Tools
Display Modes

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. The time now is 07:27 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.