We would like to know how to get href value from anchor.
<!DOCTYPE html>
<html>
<body>
<a id="link" href="http://cnn.com">Page</a>
<br>
<script type='text/javascript'>
var a = document.getElementById('link');
document.write(a.href + '<br>' + a.getAttribute('href'));
<!--from ww w. ja v a2 s. co m-->
</script>
</body>
</html>
The code above is rendered as follows: