Problem reloading image with Java
Page 1 of 1
Problem reloading image with Java
I have the following function in Java:- Code: Select all
function jsDropDown(imgid,buiildingnumber,apartmentnumber,newimg){
document.getElementById(imgid).src = "https://api.cosm.com/v2/feeds/"+buildingnumber+"/datastreams/Hidro"+apartmentnumber+".png?width=1000&height=300&colour=%23f15a24&duration="+newimg+"&legend=Litros&title=Hidr%C3%B4metro&show_axis_labels=true&detailed_grid=true"
}
The following dropdown menu:
- Code: Select all
<select name='food' align='left'; id='myList' onChange='JsDropDown('imagem','".$strbuildingnumber."','".$strapartmentnumber."','this.value')'>
<option>Select</option>
<option value='1hour'>1 hour</option>
<option value='12hours'>12 hours</option>
<option value='1month'>1 month</option>
<option value='3months'>3 months</option>
<option value='1year'>1 year</option>
</select>
And the following image:
- Code: Select all
echo "<img id='imagem' src='
https://api.cosm.com/v2/feeds/".$strbuildingnumber."/datastreams/Hidro".$strapartmentnumber.".png?width=1000&height=300&colour=%23f15a24&duration=1day&legend=Litros&title=Hidr%C3%B4metro&show_axis_labels=true&detailed_grid=true'
alt='grafico'/>
What I'm trying to do is to when someone select something on the dropdown menu the image should change to a new one, but I just can't achieve that, nothing happens when I select something on the dropdown menu.
Re: Problem reloading image with Java
1st its JAVAscript NOt JAVA2nd echo is php command not JavaScript
3rd did you tried jquery ?
Page 1 of 1