"Arthur Connor" <ar***@redseven .com> wrote in message
news:bs******** *****@news.t-online.com...
Is there a way of extracting the Javascript code from the "normal" HTML
code (e.g. similar to CSS code which can be put into a separate file) ?
If you offer a solution: can I determine in your solution where and which
part of the code should be placed/inserted in the main HTML code?
Sometimes a Javascript functionality is split up to several parts and/or
it makes a big difference where the Javascript code should run/be called
(e.g.
- in the <HEAD>....</HEAD> or
- at the beginning just behind the <BODY> tag
- at the end just before the </BODY> tag.
....)
Arty
I guess it depends on what your exact usage is. At my site I have two
different applications for js. One handles image swapping and popup display
and depends on having functions defined in advance of them being used so I
have the definitions included right before the end of the <head> as shown in
this scrap:
....
<title>
Bodger's New Day
</title>
<!-- insert image routines -->
<script type="text/javascript" src="theimager. js">
</script>
<!-- end of insert -->
</head>
....
And the actual call is made when a reader clicks on an image of a button and
looks like this:
....
<a href=
"JavaScript : newWindow = openWin( 'gallery/gallery-01-small.jpg',
600, 424 ); newWindow.focus ()">
<img src="button/small.gif" class="gbutt" alt="" title="" width="30"
height="20" /></a>
....
where openWin() is defined earlier and is called with the required
parameters here to create a new window with an image in it and the focus()
pops the new window up over the parent.
In the second main application there is no function definition so nothing
needs to appear in the <head> so the code is placed where it is needed
inline like this:
....
<!-- Start of TheCounter.com Code -->
<script type="text/javascript" src="thecounter .js">
</script>
<!-- End of TheCounter.com Code -->
....
This is done because the js provided by thecounter.com is pretty ugly and
totally blows away any attempts at validation.
Is this what you were looking for?
--
John McGaw
[Knoxville, TN, USA]
Return address will not work. Please
reply in group or through my website:
http://johnmcgaw.com