...

View Full Version : Clock with error??



Freddi
07-03-2002, 07:18 AM
I like this clock ... but I keep getting an error Expect '' for the line browser = 'Netscape'else; browser = 'NN';

As a newbie to java.. please help me

thanks

Freddi:confused:

<SCRIPT>
var browser = '';
var version = '';
var entrance = '';
var cond = '';
// BROWSER?
if (browser == '')
{
if (navigator.appName.indexOf('Microsoft') != -1)
browser = 'IE';else if (navigator.appName.indexOf('Netscape') != -1)
browser = 'Netscape'else; browser = 'NN';
}
// VERSION?
if (version == ''){
version= navigator.appVersion;
paren = version.indexOf('(');
whole_version = navigator.appVersion.substring(0,paren-1);
version = parseInt(whole_version);
}
// BROWSER & VERSION
if (browser == 'IE' && version >= 4) entrance = 'yes';
if (browser == 'IE' && version < 4) entrance = 'no';
if (browser == 'Netscape' && version >= 2.02) entrance = 'yes';
if (browser == 'Netscape' && version < 2.02) entrance = 'no';
if (entrance=='yes'){
name0a = new Image;name0a.src = 'buttons/green/nextoff.gif';
name0b = new Image;name0b.src = 'buttons/green/nexton.gif';
}
function lighten(imgName) {
if (entrance == 'yes'){
imgOn = eval(imgName + 'b.src');
document[imgName].src = imgOn;}
}
function darken(imgName) {
if (entrance == 'yes'){
imgOff = eval(imgName + 'a.src');
document[imgName].src = imgOff;}
}
// STOP HIDE -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!--
d = new Date();
dateText = "";
dayValue = d.getDay();
if (dayValue == 0)
dateText += "Sunday,";
else if (dayValue == 1)
dateText += "Monday,";
else if (dayValue == 2)
dateText += "Tuesday,";
else if (dayValue == 3)
dateText += "Wednesday,";
else if (dayValue == 4)
dateText += "Thursday,";
else if (dayValue == 5)
dateText += "Friday,";
else if (dayValue == 6)
dateText += "Saturday,";

monthValue = d.getMonth();
dateText += " ";
if (monthValue == 0)
dateText += "January";
if (monthValue == 1)
dateText += "February";
if (monthValue == 2)
dateText += "March";
if (monthValue == 3)
dateText += "April";
if (monthValue == 4)
dateText += "May";
if (monthValue == 5)
dateText += "June";
if (monthValue == 6)
dateText += "July";
if (monthValue == 7)
dateText += "August";
if (monthValue == 8)
dateText += "September";
if (monthValue == 9)
dateText += "October";
if (monthValue == 10)
dateText += "November";
if (monthValue == 11)
dateText += "December";

if (d.getYear() < 2000)
dateText += " " + d.getDate() + ", " + (1900 + d.getYear());
else
dateText += " " + d.getDate() + ", " + (d.getYear());

minuteValue = d.getMinutes();
if (minuteValue < 10)
minuteValue = "0" + minuteValue

hourValue = d.getHours();
if (hourValue == 0)
{
greeting = "Good morning, ";
timeText = " at " + (hourValue+12) + ":" + minuteValue + " AM";
}
else if (hourValue < 12)
{
greeting = "Good morning!";
timeText = " at " + hourValue + ":" + minuteValue + " AM";
}
else if (hourValue == 12)
{
greeting = "Good afternoon!";
timeText = " at " + hourValue + ":" + minuteValue + " PM";
}
else if (hourValue < 17)
{
greeting = "Good afternoon!";
timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM";
}
else
{
greeting = "Good evening!";
timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM";
}
document.open();
document.write(greeting + " It's " + dateText + timeText);
//-->
</SCRIPT>

Quiet Storm
07-03-2002, 05:24 PM
Change this:

browser = 'Netscape'else; browser = 'NN';

To this:

browser = 'Netscape'; else browser = 'NN';

Freddi
07-04-2002, 02:58 AM
Thank you Quiet thank you so much

Freddi :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum