browser concern

Cjpixel

Baseband Member
Messages
26
Hi All!

I am making a site using dreamweaver. I used javascript for the date of my website. When I tested my website using IE, everything is ok but, when I used Mozilla Firefox, the date appears on the upper left corner, outside the table I made. Here is the code:

<body>


<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;
}

// Join it all together
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
date + ", " +
(fourdigits(now.getYear())) ;


// End -->
</script>

<div align="center">
<table width="740" border="0" cellpadding="0" cellspacing="0">

------------------

So, how do i fix it to make it work for the Mozilla Firefox browser?

Thanks....
 
There are two problems as far as I can see...

The first is the code sample you have posted is so incomplete that you can't tell where you are actually calling the functions for the clock...

Since your code is so incomplete that it can't actually be debugged, I'll post some new code for you...

Code:
<html>
<head>
<script>
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year<2000)
year="19"+year
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var cdate="<small><font color='000000' face='Arial' size=1><b> &nbsp"+montharray[month]+" "+daym+", "+year + "</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else
document.write(cdate)
}
if (!document.all)
getthedate()
function goforit(){
if (document.all)
setInterval("getthedate()",1000)
}
</script>
</head>

 <body onLoad="goforit()"> 
	<table border="2" vALIGN="left">
	
	<tr>
	<td>
	</td>
	</tr>
	<tr>
	<td>
	<span id="clock"></span>
	</td>
	</tr>
	</table>
</body>
</html>
 
Back
Top Bottom