Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Help with function not defined
Old 10-03-2007, 04:28 AM Help with function not defined
Average Talker

Posts: 20
Name: Levi
Trades: 0
I'm working on some homework for a class and I created a function called worldClock() in the heading tag as shown and then I called it with the onload attribute of the body tag. Only in the firefox error console it says that "worldClock() is not defined". Can anyone tell me what i'm missing?
Thanks,
Levi
-------------------------------------------------------------- Code
<script type="text/javascript" src="../common/zones.js">
function worldClock()
{
var today = new Date();
var offSet = today.getTimezoneOffset() * 60 * 1000;

var GMT = addTime(today, offSet);
var time1 = addTime(GMT, (-360)*60*1000);
var time2 = addTime(GMT, 0*60*1000);
var time3 = addTime(GMT, (-300)*60*1000);
var time4 = addTime(GMT, (-480)*60*1000);
var time5 = addTime(GMT, 660*60*1000);
var time6 = addTime(GMT, 540*60*1000);

document.zones.place1.value = time1;
document.zones.place2.value = time2;
document.zones.place3.value = time3;
document.zones.place4.value = time4;
document.zones.place5.value = time5;
document.zones.place6.value = time6;
}


</script>
</head>

<body onload="setInterval (worldClock(), 1000);">
Levi_ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-03-2007, 04:43 AM Re: Help with function not defined
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you should not have an external script and on-page js defined in the same script block.

change to
Code:
<script type="text/javascript" src="../common/zones.js"> </script>
<script type="text/javascript">
function worldClock()
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-03-2007, 05:00 AM Re: Help with function not defined
Average Talker

Posts: 20
Name: Levi
Trades: 0
Thanks!
Levi_ is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help with function not defined
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23959 seconds with 12 queries