General discussion


Javascript Functions - Help!

By matumail ·
I am new to Javascript in web design and I can't figure this out. For some reason my function StartClock12 and function StartDate will not work while the other function are there. If I delete functions downloaddata and displaydata, StartClock12 and StartDate work fine. Can anyone tell me why? Here is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<SCRIPT language="javascript">

<!-- hide javascript

function downloaddata(){

function displaydata(data){

function StartClock12() {
Time12 = new Date();
Cur12Hour = Time12.getHours();
Cur12Mins = Time12.getMinutes();
Cur12Secs = Time12.getSeconds();
The12Time = Cur12Hour;
The12Time += ((Cur12Mins < 10) ? ':0' : ':') + Cur12Mins;
document.CForm.Clock12.value = The12Time;
window.status = The12Time;

function StartDate() {
TMonth = new Array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
TDate = new Date();
CurYear = TDate.getYear();
CurMonth = TDate.getMonth();
CurDayOw = TDate.getDay();
CurDay= TDate.getDate();
TheDate = CurDay + '/';
TheDate += TMonth[CurMonth] + '/';
TheDate += ((CurYear%1900)+1900);
document.CForm.CDate.value = TheDate;

// done hiding -->


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -


by pankraz In reply to Javascript Functions - He ...

In the first two functions the semicolon at the end of the command
line is missing. Some Browsers don't execute all the code that
comes after a scripting error. (On Mac OS X Firefox & Safari your
script runs fine even without semicolons).

Collapse -


by matumail In reply to semicolon

I went a different way and was able to make it work, but I will make note of this. Thanks for your help.

Collapse -

RE: Javascript Functions - Help!

by joseph.walsh In reply to Javascript Functions - He ...

In downloaddata() the method call


includes an argument called displaydata, which is the name of the function just below it.

Since displaydata() does not return a value, I will assume you have a variable named displaydata?

If you intended to call displaydata() as a parameter to the aforementioned method call (marqueedata.startDownload), then add a pair of parentheses to displaydata:

marqueedata.startDownload( externalmarquee.src, displaydata() )

Related Discussions

Related Forums