ok so why wont this work
i have my java script
<head>
<script type="text/javascript">
if (navigator.userAgent.match(/like Mac OS X/i)) {
document.getElementById('down').href="http://www.google.com";
}
</script>
</head>
and in the body i have
<div style="text-align: center;"><a href="http://www.twitter.com" id="down"><img src="img/download.gif"/></a></div>
but it simply just dosnt work :/
You’ve put the script in
<head>which means that the “down” anchor element doesn’t exist at the time the script is run, so there’s no href to change.Move the script to the end of body, or have the script contents run on the
loadevent.