HighDots Forums  

Probably a daft question?

Javascript JavaScript language (comp.lang.javascript)


Discuss Probably a daft question? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Harry
 
Posts: n/a

Default Probably a daft question? - 09-23-2003 , 08:50 AM






but I'm a bit puzzled with javascript functions you can include to use in a
JSP page - you can't see them in the page source code but can call them -
does this mean

they are called on the server each time - I always thought javascript was
client side only?

or are all of them in the include .js file downloaded for use at the client
end somewhere?

enlighten me someone?

thanks

harry



Reply With Quote
  #2  
Old   
steve stevo
 
Posts: n/a

Default Re: Probably a daft question? - 09-23-2003 , 09:18 AM






Include files are part of the page that is called, if the files are created
for server side use ie asp files etc then they are run on the server and
there is no need for them to be downloaded by the client, however if you
have front end code, ie .js files and have not specified them to run on the
server they will be downloaded with the page. The files will be stored on
the client allowing multiple use and in effect quicker download times long
term.

hope this helps

Simn Christie



"Harry" <a (AT) abc (DOT) com> wrote

Quote:
but I'm a bit puzzled with javascript functions you can include to use in
a
JSP page - you can't see them in the page source code but can call them -
does this mean

they are called on the server each time - I always thought javascript was
client side only?

or are all of them in the include .js file downloaded for use at the
client
end somewhere?

enlighten me someone?

thanks

harry





Reply With Quote
  #3  
Old   
Tim Slattery
 
Posts: n/a

Default Re: Probably a daft question? - 09-23-2003 , 09:24 AM



"Harry" <a (AT) abc (DOT) com> wrote:

Quote:
but I'm a bit puzzled with javascript functions you can include to use in a
JSP page - you can't see them in the page source code but can call them -
does this mean

they are called on the server each time - I always thought javascript was
client side only?

or are all of them in the include .js file downloaded for use at the client
end somewhere?
If you're talking about this kind of syntax:

<SCRIPT LANGUAGE="Javascript" SRC="something.js">

Then yes, that's handled by the client-side browser. When the browser
encounters this statement, it issues an HTML request for
"something.js", and interprets it just as if its contents were between

<SCRIPT LANGUAGE="Javascript">

and

</SCRIPT>

tags.

Various server-side processing schemes (ASP, PHP, etc) implement
server-side includes. If you use those, the included file is
transmitted to the client as part of the original request, the client
never knows that the content came from a separate file.

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov


Reply With Quote
  #4  
Old   
Harry
 
Posts: n/a

Default Re: Probably a daft question? - 09-23-2003 , 10:20 AM



Thanks chaps, makes sense now - just a bit puzzled why when viewing page
source you can't actually see the javascript functions!

"Harry" <a (AT) abc (DOT) com> wrote

Quote:
but I'm a bit puzzled with javascript functions you can include to use in
a
JSP page - you can't see them in the page source code but can call them -
does this mean

they are called on the server each time - I always thought javascript was
client side only?

or are all of them in the include .js file downloaded for use at the
client
end somewhere?

enlighten me someone?

thanks

harry





Reply With Quote
  #5  
Old   
steve stevo
 
Posts: n/a

Default Re: Probably a daft question? - 09-23-2003 , 02:27 PM



The functions are not in the downloaded page but can be references by that
page.

in this way you could have a function

eg
function showAlert(str){
alert(str)
}

and if you wanted to use the function in 2 html pages, then you include the
..js file in both and only need to download it once as it would be cached on
the client machine.

hope this helps

Simon Christie





"Harry" <a (AT) abc (DOT) com> wrote

Quote:
Thanks chaps, makes sense now - just a bit puzzled why when viewing page
source you can't actually see the javascript functions!

"Harry" <a (AT) abc (DOT) com> wrote in message
news:PcYbb.3002$qx5.26566684 (AT) news-text (DOT) cableinet.net...
but I'm a bit puzzled with javascript functions you can include to use
in
a
JSP page - you can't see them in the page source code but can call
them -
does this mean

they are called on the server each time - I always thought javascript
was
client side only?

or are all of them in the include .js file downloaded for use at the
client
end somewhere?

enlighten me someone?

thanks

harry







Reply With Quote
  #6  
Old   
Zac Hester
 
Posts: n/a

Default Re: Probably a daft question? - 09-24-2003 , 08:35 PM



Harry wrote:

Quote:
Thanks chaps, makes sense now - just a bit puzzled why when viewing page
source you can't actually see the javascript functions!

You can if you just put the name of their JavaScript file in your
browser's address bar. If you see a line like this:

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

And your browser is looking at:

http://www.example.com/mypage.html

Then, just type this:

http://www.example.com/jscode/page.js

And you will probably be prompted to save the file to your computer (or
it will just display the code). You're just duplicating what the
browser does and saving the results for your viewing enjoyment.

HTH,
Zac



Quote:
"Harry" <a (AT) abc (DOT) com> wrote in message
news:PcYbb.3002$qx5.26566684 (AT) news-text (DOT) cableinet.net...

but I'm a bit puzzled with javascript functions you can include to use in

a

JSP page - you can't see them in the page source code but can call them -
does this mean

they are called on the server each time - I always thought javascript was
client side only?

or are all of them in the include .js file downloaded for use at the

client

end somewhere?

enlighten me someone?

thanks

harry







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.