By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,729 Members | 1,490 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,729 IT Pros & Developers. It's quick & easy.

how to put javascript in a file

P: n/a
i'm just finishing a web page with a fair amount of javascript, or seems
that way to me being my first attempt at this.
http://job1data.com/phsvolunteer.HTM
for this particular page i'm not so concerned about 'hiding' the javascript
but keep hearing references to putting it in a file to hide it and am
not sure how to do that. i want the code to be executed at the client
browser side, not back at the server
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> for this particular page i'm not so concerned about 'hiding' the javascript
but keep hearing references to putting it in a file to hide it and am
not sure how to do that. i want the code to be executed at the client
browser side, not back at the server


There are lots of good reasons to put your programs in .js files, and execute
them with

<script src="yourfilename.js"></script>

Put forget about hiding it. It won't stay hidden. Don't even think about it.

http://www.crockford.com

Jul 20 '05 #2

P: n/a
bbxrider wrote:
i'm just finishing a web page with a fair amount of javascript, or seems
that way to me being my first attempt at this.
http://job1data.com/phsvolunteer.HTM
for this particular page i'm not so concerned about 'hiding' the javascript
but keep hearing references to putting it in a file to hide it and am
not sure how to do that. i want the code to be executed at the client
browser side, not back at the server


I looked at your code. Just take all your code between your script tags
and put it into it's own file with a .js extension. NOTE: do NOT put
the script tags into this file, just everything in between them.

Then change the script tag in your page to something like:

<script type="text/javascript" src="example.js"></script>

Where example.js is the name of the file you created in the first step
above.

HTH

George

Jul 20 '05 #3

P: n/a
thanx for your help, any suggestions or is there something like a default
standard
on which directory and its permissions to put the .js files for iis5.0, i'm
my own administrator
for now
"bbxrider" <bb*******@comcast.net> wrote in message
news:Yep7b.298389$Oz4.89065@rwcrnsc54...
i'm just finishing a web page with a fair amount of javascript, or seems
that way to me being my first attempt at this.
http://job1data.com/phsvolunteer.HTM
for this particular page i'm not so concerned about 'hiding' the javascript but keep hearing references to putting it in a file to hide it and am
not sure how to do that. i want the code to be executed at the client
browser side, not back at the server

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.