title: HTML - calling javascript by clicking on image
body: <p>I'm trying to call javascript by clicking on the image but it's not working.<br>
  Please refer below for my code.</p>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
  var image1=new Image()
  image1.src="images/Image_1.png"
  var image2=new Image()
  image2.src="images/Image_2.png"
  var image3=new Image()
  image3.src="images/Image_3.png"
  //--&gt;
  
    function login(showhide){
      if(showhide == "show"){
          document.getElementById('popupbox').style.visibility="visible";
      }else if(showhide == "hide"){
          document.getElementById('popupbox').style.visibility="hidden"; 
      }
    }
    &lt;/script&gt;
  </code></pre>
  
  <p>my code</p>
  
  <pre><code>&lt;div id="apDiv21"&gt;&lt;img src="images/Login_OnOut.png" width="71" height="44" 
  onmouseover="this.src='images/Login_OnRollover.png'" 
    onmouseout="this.src='images/Login_OnOut.png'" onclick="login('show');" /&gt;
  
    &lt;div id="popupbox"&gt; 
  &lt;form name="login" action="" method="post" style="background-color:#C7C7C7"&gt;
  &lt;center&gt;Username:&lt;/center&gt;
  &lt;center&gt;&lt;input name="username" size="14" /&gt;&lt;/center&gt;
  &lt;center&gt;Password:&lt;/center&gt;
  &lt;center&gt;&lt;input name="password" type="password" size="14" /&gt;&lt;/center&gt;
  &lt;center&gt;&lt;input type="submit" name="submit" value="login" /&gt;&lt;/center&gt;
  &lt;/form&gt;
  &lt;center&gt;&lt;a href="login('hide');"&gt;close&lt;/a&gt;&lt;/center&gt; 
  &lt;/div&gt; 
  </code></pre>