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
Change this: <a href="#"><id="url"></a> to this: <a href="#" id="url"></a> And after this line: document.getElementById("url").href = arr[nowDate-1][0]; add this: document.getElementById("url").appendChild(document.createTextNode(arr[nowDate-1][0]));
Was able to test it faster than I thought. It works great phper!!! But not for what I needed. But I may need that someday anyway thank you very much. But what I was looking for was rotating an actual url and inserting that into another page, not a link. Don't write anything for rotating urls with an Iframe though, I already have one of those. Was looking to see if there was a way javascript could insert the url without using an iframe. If you think of a way let me know, otherwise don't sweat it and thanks again. Jen-