473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to put javascript in a file

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
3 3059
> 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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
21
by: ryanmhuc | last post by:
I know the subject might be confusing. I am no beginner with javascript but I haven't been able to figure out how to get the javascript file name from code inside the file. So you have an HTML...
10
by: VictorG | last post by:
Hello, I am new to JS and am trying to add some HTML into a JS function. So that when called the script as well as the HTML will be invoked. Is there some type of embed mechanism, sort of the...
5
by: mgershma | last post by:
Hi. Does anybody know how can JavaScript get the filename of the file it's located in? For example, file 'mike.js' contains several functions and variables. I would like to set the variable...
21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
14
by: Rich | last post by:
I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 (.NET v2.0.50727). The entire solution uses serveral technologies - Windows Server 2003 (AD, SQL Server 2000, IIS,...
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, This is an issue that happens to me and everybody else I know and I've never found a way around it. In Visual Studio (currently using 2003 but the same has happened for me in 2005 and...
2
hsriat
by: hsriat | last post by:
For a good programmer, providing good comments in the code is a must. In PHP, giving comments has no demerits. But what about JavaScript? Do you really want those comments to stay in the code and...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.