Question

Locked

JS date code displays date in IE bt not Mozzilla - help!

By twanstall ·
Hi all,

Please help, im stuck!

i have created a simple date ultility using java script, here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<SCRIPT language=JavaScript src="time.js"></SCRIPT>
</head>

<body>
<SCRIPT language=JavaScript>
document.writeln(year+"-"+monthname[month]+"-"+date+"");
</SCRIPT>
</body>
</html>

In addition to this i have inserted this java script into another page:

// JavaScript Document
//set date into variables
var todaysdate = new Date();
year = todaysdate.getFullYear();
month = todaysdate.getMonth();
date = todaysdate.getDate();
day = todaysdate.getDay();

//set the arrays
var monthname = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var dayname = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); but it doesnt in Mo


The Thing this code generates the date fine, in IE but doesnt in Mozzilla (which is what my wesite is built to use)....anyone know why???

please help

Thankyou

Tom

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Are you sure that is the problem?

by MadestroITSolutions In reply to JS date code displays dat ...

If you look in the Mozilla JavaScript reference the Date object does exist and it has the properties you are using. See the following link:

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Predefined_Core_Objects:Date_Object

Have you debugged the code to make sure that is the problem? I would go over it line by line outputting the values as you retrieve them to make sure you pinpoint the problem.

This is the main link to the JavaScript Language reference in Mozilla:

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference

Let me know if you need any more help.

Good luck!

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums