js files
I was told that putting my java script in an external js file would help the SE find my relevent text on my homepage easier, but my server doesn't support js, jsp files. Any suggestions? They said I could use another script. I don't really know what they meant. I'm still trying to learn.
ddf1230 posted this at 20:32 — 22nd January 2006.
They have: 17 posts
Joined: Jan 2006
A .js file is not the same as a .jsp file. I think maybe your host got confused. I'd be willing to bet that if you tried it, it would work. Try it out on a test page and see what happens.
Win a free copy of Windows Vista
timjpriebe posted this at 15:08 — 23rd January 2006.
He has: 2,667 posts
Joined: Dec 2004
It should work fine. Saying a server doesn't support JS files is like saying a server doesn't support HTML files. It's just never true.
The technical reason behind this is that JS and HTML are what is referred to as client-side applications. Your computer is just downloading text from the server, then trying to execute or interpret that text.
What you sometimes have to worry about is server-side applications. PHP, PERL and ASP are all examples of file types that are server-side applications. The server first executes these files, then sends the resulting text to your computer.
Wikipedia has a couple of articles on this:
Tim
http://www.tandswebdesign.com
timjpriebe posted this at 15:09 — 23rd January 2006.
He has: 2,667 posts
Joined: Dec 2004
Oh, and here's a tutorial on using external javascript files:
http://www.tizag.com/javascriptT/javascriptexternal.php
xyphlo posted this at 06:40 — 28th January 2006.
They have: 16 posts
Joined: Jan 2006
I tried referencing the js file I created on a test page and I received an Internet Explorer script error. How should I resolve this? It said it was an "Expected" error.
Busy posted this at 07:31 — 28th January 2006.
He has: 6,151 posts
Joined: May 2001
did you put <script> tags inside the .js file? if so take them out.
The error should of told you the line number and postion on the line of the problem
xyphlo posted this at 17:41 — 28th January 2006.
They have: 16 posts
Joined: Jan 2006
Yes, I took out the <scripts> tags. My file begins with this: language="JavaScript" type="text/JavaScript">
Should that also be taken out? My error says it's line 2 character 24 which I think is the "type" part. Do you see anything wrong with this script? Thanks for your help
Busy posted this at 18:51 — 28th January 2006.
He has: 6,151 posts
Joined: May 2001
yes take out language="JavaScript" type="text/JavaScript">
, should just be the javascript code in there
xyphlo posted this at 22:07 — 28th January 2006.
They have: 16 posts
Joined: Jan 2006
Thank you. I left this on the web page: <script src="scripts.js" language="JavaScript" type="text/JavaScript">
</script> and everything else in the js file and it seemed to work. Thanks for your help.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.