The whole concept is poor. If you have a link, USE the link. Either directly without script (good for all browsers and for SEO) or change the href or the onclick of the LINK
Also do NOT have numeric IDs
<html>
<head>
<title>Index</title>
<script type="test/javascript">
var myLinks = [
'http://bing.com/search?q=go',
'http://bing.com/search?q=visit',
'http://bing.com/search?q=explore',
'http://bing.com/search?q=funny%20pics'
]; // note no comma on the last item
window.onload=function() {
for (var i=0;i<myLinks.length;i++) {
// EITHER document.getElementById("d"+i).getElementsByTagName("a")[0]).href=myLinks[i];
// OR
document.getElementById("d"+i).getElementsByTagName("a")[0].onclick=(function(idx) {
var idx = i;
return function() { // closure
location=myLinks[idx];
return false; // cancel href
}
})(i);
}
}
</script>
</head>
<body>
<div id="d0"><a href="#"">GO</a></div>
<div id="d1"><a href="#"">VISIT</a></div>
<div id="d2"><a href="#"">EXPLORE</a></div>
<div id="d3"><a href="#"">FUNNY PICS</a></div>
</body>
</html>