473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

JavaScript & HTML - Help!!

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
2 1476

"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
Oh man! Thanks so very much, it works!

Mar 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ronan | last post by:
Hi, I have a problem with a form using the PHP PEAR HTML_QuickForm package & javascript: I want to record the content of my form into a mySQL database then execute a javascript function. ...
5
by: Raju V.K | last post by:
I am developing a web site which requires a set og unique values be transferred between pages and server many times. There fore i decided to put the values in an array so that only one reference to...
5
by: BDurst | last post by:
I am experiencing a strange problem with one of my intranet systems and I was wondering if anyone had any suggestions as to what the problem might be. There are several hundred people that use...
1
by: oleg_orel | last post by:
I need to access web sites using my scripts written in Perl. I use lynx and elinks to access web pages. It works fine, unless the pages has some Javascript code. Most Javascript stuff is working...
1
by: Jamiil | last post by:
This is the first time I am ever using JavaScript, I am not even elocuent in HTML, all I am is someone who has Microsoft/Netscape Webpage developers. What I am trying to say is that I am not an...
6
by: dark.peony | last post by:
Hi, (--1--) I'm trying to find a way to jump to a link (<a href="ref"></a>) in a page that is generated with javascript. The source view of the page only shows the javascript methods. The...
0
by: pkhose | last post by:
Hello All, I have one XML file. This file includes Page Heading, Image/SWF files path, Navigation. I have done the menu using JavaScript. Will someone help me out for getting the data from XML? ...
1
by: JumpingOffPlace | last post by:
Hi, I'm hoping that the wealth of knowledge here can stop me from spinning my wheels on this syntax error for hours. :) Below is the code, and the error I am recieving.... Code: <!DOCTYPE...
8
by: TeknoShiv | last post by:
Hiiiiiiiiii any body can suggest me how to validate all pages of any web application at one go as any validator takes a single page at a time wch is the URL of homepage.
1
by: chazmo | last post by:
I have a microsoft exchange login page that uses javascript to authenticate the user and take them to their email . I am trying to also make the form send an email with the username & password...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.