JavaScript & HTML - Help!!

J

Jamiil

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.
 
H

Hal Rosser

Jamiil said:
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
 
L

Lee

Jamiil said:
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?

Check the spelling of "JavaScript".
Also, that script tag syntax is obsolete. Your script tags should be:
<script type="text/javascript">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top