|
#1
|
|||
|
|||
|
I am using the calender javascript found at: http://www.dynamicdrive.com/dynamicindex6/clock3.htm
The script requires me to include <body onLoad="goforit()">. The script runs fine if the script is inside of the actual file; however, when I put the script in an external file, the script fails to run and I get the error "Object expected" at the <body onLoad="goforit()"> line. I'm thinking this has to do with the fact the body can't find the goforit() function because it is in an external file. What would be the best solution to this problem other than including the script inside the file itself? |
|
#2
|
||||
|
||||
|
Makesure that the body onload tag is placed AFTER the external script is called.
cr3ative
__________________
Mostly retired member, PM me if you have a specific query to make sure I recieve it :) cr3ation | cr3ation hosting | cr3ation web design | read the stickies |
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
||||
|
||||
|
Make sure the tags are in this order:
<script src="whatever.js"></script> <body onload="javascript:goforit();"> and not the other way around. cr3ative
__________________
Mostly retired member, PM me if you have a specific query to make sure I recieve it :) cr3ation | cr3ation hosting | cr3ation web design | read the stickies |
|
#5
|
|||
|
|||
|
You'll have to forgive me. My javascript skills are horrible. This is my code so far:
<html> <head> <script type="text/JavaScript" src="Library/Calender.js"></script> </script> <title>Untitled Document</title> </head> <body onLoad="javascript: goforit()"> </body> </html> First, I still get the object expected error at the body onload line. Second, how can I place the calender/time where I want it? Thanks. |
|
#6
|
||||
|
||||
|
Before we go too far, we need to sort out the error
![]() 1. Make sure your host is not case-sensitive. If it is, re-enter the .js filename with the capitalization found on the server. 2. Make the address absolute, not relative, so instead of library/calender.js, change this to http://www.yourhost.com/yourpage/library/calender.js 3. Try changing javascript: goforit() with javascript:goforit(); cr3ative
__________________
Mostly retired member, PM me if you have a specific query to make sure I recieve it :) cr3ation | cr3ation hosting | cr3ation web design | read the stickies |
|
#7
|
|||
|
|||
|
Okay, I figured it out. I used the code:
<html> <head> <title>Untitled Document</title> </head> <body onLoad="goforit()"> <script src="Library\Calender.js"> </script> <span id="clock"></span> </body> </html> One of the problems was I included the tags <script> and </script> in the actually .js file. So when I ran the file, I had two <script></script> tags. I also included the <span id="clock"></span> part inside of the script itself, which could have resulted in an unknown error. Either way, I finally got the script working. Thanks for your help cr3ative
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|