Use these to jump around or read it all…
What I’m Talking About
The Time Stamp Example
Okay, so there’s not a lot to it, but it’s good for this discussion.
Or go look… I don’t care.
A little more detail please, Joe…
<!– hide script from old browsers
test = new Date()
// end hiding script from old browsers –>
Create The JS File
Take the script and paste it, all by itself, into a word processor. It should be the only thing on the page. Now, knock off the beginning and end SCRIPT commands. These things:
Get rid of them. Erase them. You’ll pick them up again later. Now the page should look like this:
Now do a SAVE AS command and save the file as TEXT only (the same way you would an HTML file), give it a name and add the extension .js.
Let’s say you want to name this file “george”. Do a Save As, making sure you are saving as text alone, and give the file the name “george.js”. Okay, you’re done with that.
To get its effect on my page, I placed these commands:
A Few Things To Keep In Mind
Through my trial and error, I found a couple of concerns:
Scripts that have multiple parts throw a lot of errors. It’s better to just paste the script onto the document in those cases.
- This will not work with multiple scripts in the same .js file.
Remember The <!– and –>