Click to See Complete Forum and Search --> : help!


DanUK
08-03-2003, 08:22 AM
Hi can anyone tell me what's wrong with this please? I get some of my visitors getting errors which state:


Object doesn't support this property or method
line 260
char 3

line260 of my site was: document.getElementById('ag_clock').innerHTML = s + post;


<script type="text/javascript">
<!-- /* Clock */

// Change the variables below to your preferences.
// If you do not know what a variable does, leave the default.
// Use quoted strings for these variables:
var ClockColor = "grey";
var ClockBackground = "transparent";
var ClockFont = "Tahoma";
var ClockCustomStyle = "";
var ClockLoadingText = "Loading clock...";

// Use true or false for these variables:
var Clock24Hour = false;
var ClockShowAmPm = true;
var ClockShowSeconds = true;
var ClockPadWithZeros = true;

// Do not change below this line.

var today = new Date();
var hours = today.getHours();
var mins = today.getMinutes();
var secs = today.getSeconds();

document.write('<span id="ag_clock" style="color: ' + ClockColor + '; background: ' + ClockBackground + '; font-family: ' + ClockFont + ';' + ClockCustomStyle + '">' + ClockLoadingText + '</span>');
UpdateClock();


function UpdateClock(){
post = "";
secs++;
if (secs>=60){secs = 0;mins++;}
if (mins>=60){mins = 0;hours++;}
if (hours>=24){hours = 0;}

if (!Clock24Hour && hours > 12){
shours = hours - 12;
} else {
shours = hours;
}

if (shours == 0) shours = 12;

if (ClockShowAmPm && hours < 12) post = " AM";
if (ClockShowAmPm && hours >=12) post = " PM";

if ((shours<10) && ClockPadWithZeros){
s = "0" + shours + ":";
} else {
s = shours + ":";
}

if ((mins<10) && ClockPadWithZeros){
s = s + "0" + mins;
} else {
s = s + mins;
}

if (ClockShowSeconds){
if ((secs<10) && ClockPadWithZeros){
s = s + ":0" + secs;
} else {
s = s + ":" + secs;
}
}

document.getElementById('ag_clock').innerHTML = s + post;
setTimeout("UpdateClock()", 1000);
}
//-->
</script>

Khalid Ali
08-03-2003, 09:06 AM
Problem is not in your javascript(at least not in th eline which you posted for error).
This possibley means that the browser you are getting this error on does not support this method/property.....

or you may have something wrongin you html part of hte code..post a lin to th epage

DanUK
08-03-2003, 09:08 AM
hi khalid, thanks for your reply.
unfortuantely I cannot paste a link to the site as it's on an intranet, however, in all the browsers I tried from my FreeBSD box, i.e. Mozilla/Konqueror/Opera it works fine, I will try and find out what browsers they are using. That is the only code relevant to the clock.
Thanks again.