Hello, I found a link script I like but I would like the link to show up as a link instead of an http address. The javascript rotates the link http: address daily. How can I make it look like a link like this web page name instead of this: http://www.google.com? Heres the all the code. For web page <BODY onload="changing();"><a href="#" id="url"></a> For external.js arr = new Array( ["http://www.google.com/"], ["http://www.google.com/"]// no comma at the end of last index ); now = new Date() nowDate = now.getDate() function changing(){ if(nowDate > arr.length) { return; } document.getElementById("url").href = arr[nowDate-1][0]; document.getElementById("url").appendChild(document.createTextNode(arr[nowDate-1][0])); } Please let me know, thank you very much, Jen
Thanks alot, it didn't work. I put your link inside the brackets and quotation marks like this with no luck. ["<a href='http://www.google.com'>LinkName</a>"], All it did was put all of it on the page instead of just "LinkName."
Nope that didn't work either so I tried this "<a href='http://www.google.com'>LinkName</a>", Still no luck but thanks for the help. Anyone know?
Hi, Try this for the whole script. <script type='text/javascript'> arr = new Array( ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"], ["Go to Google"],["http://www.google.com"]); now = new Date(); nowDate = now.getDate(); function changing(){ if (nowDate*2 > arr.length) return; document.getElementById("url").href = arr[nowDate*2-1][0]; document.getElementById("url").appendChild(document.createTextNode(arr[nowDate*2-2][0])); } </script> <BODY onload="changing();"> <a href="#" id="url"></a> </body> Code (markup): The script changes the urls everyday, so you need to have as many lines of: ["Go to Google"],["http://www.google.com"], Code (markup): as there are days in a month. Just change the ["Go to Google"],["http://www.google.com"], Code (markup): lines to different values to have different urls appear. Cheers.