Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-02-2005, 11:47 PM   #1
Baseband Member
 
Join Date: Mar 2004
Posts: 26
Default browser concern

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','Thu rsday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May',' June','July','August','September','October','Novem ber','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....
__________________

Cjpixel is offline   Reply With Quote
Old 05-03-2005, 08:59 AM   #2
Fully Optimized
 
technoman's Avatar
 
Join Date: Dec 2004
Posts: 3,382
Default Re: browser concern

put the code in a table
__________________

__________________
~~~ tEcHnOmAn ~~~
technoman is offline   Reply With Quote
Old 05-11-2005, 03:37 PM   #3
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: browser concern

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>
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 03:12 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0