A
Amy
Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why? Please let me
know, thanks, Amy
one that works by day just following and works correctly. <BODY
onload="changelink();"><a href="#" id="url"></a>
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
now = new Date();
nowDate = now.getDate();
function changelink(){
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]));
}
The following works by milliseconds. It only switches from the left
item to the right item
but left item isn't a link to the right item like it is supposed to be.
Can anyone help me fix it? Thank you very much. <BODY
onload="changelink();"><a href="#" id="url"></a>
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
var dynLink = null;
function init() {
dynLink = document.getElementById('url');
window.setTimeout('changeURL(0)',1000);
}
function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.innerHTML = arr[0];
dynLink.href = arr[1];
window.setTimeout('changeURL('+(++i)+')',1000);
}
window.onload = init;
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why? Please let me
know, thanks, Amy
one that works by day just following and works correctly. <BODY
onload="changelink();"><a href="#" id="url"></a>
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
now = new Date();
nowDate = now.getDate();
function changelink(){
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]));
}
The following works by milliseconds. It only switches from the left
item to the right item
but left item isn't a link to the right item like it is supposed to be.
Can anyone help me fix it? Thank you very much. <BODY
onload="changelink();"><a href="#" id="url"></a>
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
var dynLink = null;
function init() {
dynLink = document.getElementById('url');
window.setTimeout('changeURL(0)',1000);
}
function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.innerHTML = arr[0];
dynLink.href = arr[1];
window.setTimeout('changeURL('+(++i)+')',1000);
}
window.onload = init;