Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

External Javascript

Status
Not open for further replies.

masteryamaha

Programmer
Feb 13, 2005
15
US
How do you link to an external javascript file, not only in the heading but alos the element in the body. Can javascripting be put into classes like html in css and could I put javascripting classes in a css file.
 
Put the following code in the head section of the HTML file.

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

You can call function that are inside that .js file the same as if the code was in the script section of your HTML File.

Kevin Petursson
 
how would i format the function in the .js file and how would i it out in the element.
 

You don't need to apply any special formatting to functions inside JS files - just write however you would normally write JS code.

Dan


The answers you get are only as good as the information you give!

 
what do you mean
"and how would i it out in the element"

as for the formatting. There are many great web pages to learn about programming in javascript.
is a good one.

Basically
function name(){
//your code goes here
return name;
}

Hope this healps. The more detail you give, the better the anwser you will get.

Kevin Petursson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top