Jen-
Aug 28th 2006, 2:03 am
Hello, I am trying to call on javascript to insert a url address into another page which changes daily. Here is what I have connected by a external .js link.
arr = new Array(
["http://www.website.com/test.html"],
["http://www.mooonbaby.com/test2.php"]
now = new Date()
nowDate = now.getDate()
function changeurl(){
if(nowDate > arr.length) { return; }
document.getElementById("url").href = arr[nowDate-1][0];
}
___________________________________________________________
And this goes in the body.
<p style="margin-left: 0px;"><BODY onload="changeurl();">
<a href="#"><id="url"></a></p>
Can anyone see why it doesn't work? Is it because the href usually deals with links only and images? Thanks!! Jen
arr = new Array(
["http://www.website.com/test.html"],
["http://www.mooonbaby.com/test2.php"]
now = new Date()
nowDate = now.getDate()
function changeurl(){
if(nowDate > arr.length) { return; }
document.getElementById("url").href = arr[nowDate-1][0];
}
___________________________________________________________
And this goes in the body.
<p style="margin-left: 0px;"><BODY onload="changeurl();">
<a href="#"><id="url"></a></p>
Can anyone see why it doesn't work? Is it because the href usually deals with links only and images? Thanks!! Jen