Change element value as click anchor link - Javascript DOM Event

Javascript examples for DOM Event:onclick

Description

Change element value as click anchor link

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Sandbox</title> 
      <meta http-equiv="Content-type" content="text/html; charset=utf-8"> 
      <script>var clickCount= 0;
      </script> 
   </head> 
   <body> 
      <a href="http://www.google.com" target="_blank" onclick="document.getElementById('dbg').innerHTML = ++clickCount"> open new </a> 
      <div id="dbg"></div>  
   </body>/*from  ww  w  . jav a 2 s  .  co m*/
</html>

Related Tutorials