cute.bandar
Cyborg Agent
HI, I am making a site for which require a bit of javascript magic. asking for your help because I am still learning javascript.
Javascript Code -
Html code -
In this whenever a selection on the listbox is made changeMap() is called and an image is loaded. What I want to do is, pass the 'value' of the <option> selected, to the function changeMap , so that it can be used there.
How ?
thanks
Edit: nvmind, I found a solution:
changemap has to be changed to -
Javascript Code -
Code:
function changeMap()
{
imagesource = "*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 -
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 to do is, pass the 'value' of the <option> selected, to the function changeMap , so that it can be used there.
How ?
thanks
Edit: nvmind, I found a solution:
changemap has to be changed to -
I still don't understand why this works though..changeMap(this.options[this.selectedIndex].value)
Last edited: