Login | Register | FAQ
Anonymous

Problem reloading image with Java

+ Post a reply

2 posts Page 1 of 1


Problem reloading image with Java

by blacblu » Wed Jul 04, 2012 11:34 pm

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.
User avatar

blacblu

  • Posts: 5
  • Joined: Fri Jun 29, 2012 12:26 am

Re: Problem reloading image with Java

by XainPro » Thu Jul 05, 2012 10:54 am

1st its JAVAscript NOt JAVA
2nd echo is php command not JavaScript
3rd did you tried jquery ?
User avatar

XainPro

  • Posts: 3616
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1

?>