By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,507 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,507 IT Pros & Developers. It's quick & easy.

JavaScript & HTML - Help!!

P: n/a
This is the first time I am ever using JavaScript, I am not even
eloquent in HTML, and all I am is someone who has Microsoft/Netscape
Webpage developers. What I am trying to say is that I am not an expert
in any of these webpage developing languages. Now, having said that,
here is my problem.
I got this program from the book JavaScript "The definitive Guide 3rd
Edition, by David Flanagan, published by O'Reilly,

<SCRIPT LANGUAGE="JavaScript">
function printDate(){
var date = new Date();
document.write(date.toLocaleString());
}
</SCRIPT>
The book shows that this part of the puzzel goes in the <HEAD> and
</HEAD> tags, the implementation of this function is within the <BODY>
and </BODY> tags. However, when implementing the function, I get
nothing, it does not display de date, it does nothing. Here is the
code:

<html>
<head>
....
<title>Jamiil's Home Page</title>
<SCRIPT LANGUAGE="JavaScript">
function printDate(){
var date = new Date();
document.write(date.toLocaleString());
}
</SCRIPT>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="103%"
id="AutoNumber3" bgcolor="#000000">
..............
</table>

<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#FFFFFF" width="10%"
id="AutoNumber1" height="67" bgcolor="#000000">
<tr>
<td width="1009%" height="516">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%"
id="AutoNumber4" bgcolor="#000000" height="523">
<tr>
<td width="100%" bgcolor="#000000" height="142">
<img border="0" src="allah.gif" align="left" width="126"
height="141"></td>
</tr>
<tr>
<td width="100%" height="19"><b><font color="#FFFFFF" size="1">

//-----> HERE IS THE CODE IN QUESTION <--------
<SCRIPT LANGUAGE="JavaScritp">
printDate();
</SCRIPT>
</font></b></td>
</tr>
<tr>
..........

Now, can you tell me what am I doing wrong and how to get the current
date to be displayed in the table cell?

TIA.

Mar 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Jamiil" <ja******@netscape.net> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
This is the first time I am ever using JavaScript, I am not even
eloquent in HTML, and all I am is someone who has Microsoft/Netscape
Webpage developers. What I am trying to say is that I am not an expert
in any of these webpage developing languages. Now, having said that,
here is my problem.
I got this program from the book JavaScript "The definitive Guide 3rd
Edition, by David Flanagan, published by O'Reilly,

<SCRIPT LANGUAGE="JavaScript">
function printDate(){
var date = new Date();
document.write(date.toLocaleString());
}
</SCRIPT>
The book shows that this part of the puzzel goes in the <HEAD> and
</HEAD> tags, the implementation of this function is within the <BODY>
and </BODY> tags. However, when implementing the function, I get
nothing, it does not display de date, it does nothing. Here is the
code:

<html>
<head>
...
<title>Jamiil's Home Page</title>
<SCRIPT LANGUAGE="JavaScript">
function printDate(){
var date = new Date();
document.write(date.toLocaleString());
}
</SCRIPT>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="103%"
id="AutoNumber3" bgcolor="#000000">
.............
</table>

<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#FFFFFF" width="10%"
id="AutoNumber1" height="67" bgcolor="#000000">
<tr>
<td width="1009%" height="516">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%"
id="AutoNumber4" bgcolor="#000000" height="523">
<tr>
<td width="100%" bgcolor="#000000" height="142">
<img border="0" src="allah.gif" align="left" width="126"
height="141"></td>
</tr>
<tr>
<td width="100%" height="19"><b><font color="#FFFFFF" size="1">

//-----> HERE IS THE CODE IN QUESTION <--------
<SCRIPT LANGUAGE="JavaScritp">
printDate();
</SCRIPT>
</font></b></td>
</tr>
<tr>
.........

Now, can you tell me what am I doing wrong and how to get the current
date to be displayed in the table cell?

TIA.

For one thing - you did not spell JavaScript correctly in the Script tag.
Correct that and it should display the date in white text on black
background.
Even though you're using some deprecated tags and other errors, the date
shows up in a test page I pasted your code into (after closing the missing
table, body, and html tags
Mar 15 '06 #2

P: n/a
Oh man! Thanks so very much, it works!

Mar 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.