Menu

Question Relates Javascript Could Please Help Get Code Working Want 2 Buttons Image Click Q43802730

This question relates to Javascript.

Could you please help me get my code working. I want to have 2buttons and an image. When I click the ‘bigger’ button the imageshould increase in size by 10%. When I click the ‘smaller’ buttonit needs to get smaller by 10%. Please keep the code as simple aspossible because I am new to Javascript.

<html>
<head>      
       <title></title>
      
<script>
      
       var bigger;
       var smaller;
       var tree;
             
       /**
* This function increases the size by 10%
*/
       function biggerTree(){
          document.getElementById(“bigger”).style.”width:10%;height:10%”;
       }  
      
          
       function biggerTree(){
          document.getElementById(“smaller”).style.”width:-10%;height:-10%”;
       }  
      
          
  
                     
</script>
</head>

<body>
      
       <img id=”tree” src=”tree.jpg”alt=”picture not located” style=”width:30%;height:30%”>
       <button id=”bigger” onClick =”biggerTree()”>Increase Size</button>
       <button id=”smaller” onClick =”smallerTree()”>Decrease Size</button>
   </body>
</html>

Expert Answer


Answer to This question relates to Javascript. Could you please help me get my code working. I want to have 2 buttons and an image…

OR