I have a limited knowledge of JavaScript, but this seemed to do the trick:
Code:
<html>
<head>
<script type="text/javascript">
function updatebox() {
alert('Hi DynamicDrive!')
}
</script>
</head>
<body>
<a href="http://www.google.com">doesn't work</a>
<a href="http://www.google.com">does work</a>
anexample o f an image clicking
<a href="http://www.google.com"><img
src="http://www.google.com/images/nav_logo7.png"></img></a>
<script type="text/javascript">
tds = document.getElementsByTagName("a");
for( var x=0; x < tds.length; x++ ) {
tds[x].setAttribute('onclick', 'updatebox()');
}
</script>
</body>
</html>
@Bluewalrus - The for loop goes through all the elements with the anchor tag <a>, then sets the onclick event of each of them to call "updatebox", which in turn alerts "Hi DynamicDrive!" before proceeding to the webpage specified.
Bookmarks