Click to See Complete Forum and Search --> : Calling Javascripts


johnpratt12
06-26-2004, 01:22 AM
I need help setting up a separate folder for all my java scripts, or CGI scripts and setting a link to the individual script with HTML.

Any help that would explain how to do this properly would be greatly appreciated.

Fang
06-26-2004, 03:44 AM
Linking and calling style and JavaScript functions:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Basic linking</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="StyleSheet" href="mycss.css" type="text/css" />
<script type="text/javascript" src="jscript/main.js"></script>
</head>
<body>
<div class="news" onmouseover="MyJSfunction();">insiderdealer</div>
</body>
</html>

johnpratt12
06-26-2004, 05:39 PM
Originally posted by Fang
Linking and calling style and JavaScript functions:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Basic linking</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="StyleSheet" href="mycss.css" type="text/css" />
<script type="text/javascript" src="jscript/main.js"></script>
</head>
<body>
<div class="news" onmouseover="MyJSfunction();">insiderdealer</div>
</body>
</html>


Thanks Fang, but what I want to do is store all my scripts outside the individual pages in a separate folder (or directory) and call them from several different pages to save some repetitive typing. I think that I may be misreading the above, could you possibly explain it line by line.

For example:
Say I have a script called "tracker", and I want to have this on all my pages, so I set up a folder(directory) named "java.bin" and place the "tracker" script in it. How woulds I call that specific script to the appropriate position on each page? By the way, the individual action of the script may not be visible to the viewer.

MstrBob
06-26-2004, 05:51 PM
As Fang showed you, simply put


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


Wherever in your page you wish it to go, and boom! it goes there. :D

IncaWarrior
06-26-2004, 07:29 PM
It's the equivilent of including the script on the page

johnpratt12
06-27-2004, 10:49 AM
Thanks to you all for your help. Sorry I simply misread fang's original reply. Keep in touch.