load different images for each item on the listbox
Posted
by
user161179
on Stack Overflow
See other posts from Stack Overflow
or by user161179
Published on 2010-12-26T19:50:07Z
Indexed on
2010/12/26
19:53 UTC
Read the original article
Hit count: 122
JavaScript
|listbox
Javascript:
function changeMap()
{
imagesource = "http://maps.google.com/maps/api/staticmap?size=500x500&maptype=hybrid&zoom=16&sensor=false&markers=color:blue|label:K|28.541250,77.204100" ;
mapimage.src = imagesource ;
}
Html code :
<select name="choose_colony" id="choose_colony" size="8" onchange="changeMap()" style="float: left;">
<option value="1" >Big apartments</option>
.
.
<option value="999">plaza</option>
</select>
<img name="mapimage" src="" alt="Select your Colony" style="float: right;">
In this whenever a selection on the listbox is made changeMap is called and an image is loaded. What I want is for a different image to be loaded everytime depending upon the option selected .
there will be over 2000 entries in the listbox. Considering this what is the best way of going about this ? I can figure out the if/then part , but my main question is whether its ok to put all the 2000 long image addresses in the html file itself ? I hope I was clear ..
© Stack Overflow or respective owner