prosoftsolutionsinc
asked on
Syntax to Include JS file in HTML code
What is the syntax to include a JS file in HTML code and then call functions within the JS file?
David
David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi, as usual
Add the tag like this:
<SCRIPT LANGUAGE="JavaScript1.2" SRC="../include/js/mainArr ays.js"></ SCRIPT>
The mainArrays.js document:
__________________________ __________ __________ __________ _
arMenu1 = new Array(
120,
144,122,
"","",
"","",
"","",
"Introduction","../petrol/ petrol.htm ",0,
"S2000 Product Specification","../petrol/ S2000_pdt_ specificat ion.htm",0 ,
"E'MAX Technology","../petrol/Ema x_tech.htm ",0,
"Product Warranty","../petrol/pdt_w arranty.ht m",0,
"Product Liability","../petrol/pdt_ liability. htm",0,
"Installation Procedure","#",0,
"Petrol Test Report","../petrol/TestRep ort.htm",0 ,
"Customer Reference","../petrol/cust omer_refer ence.htm", 0
)
arMenu2 = new Array(
120,
144,140,
"","",
"","",
"","",
"Introduction","../diesel/ diesel.htm ",0,
"Product Specification","../diesel/ pdt_specif ication.ht m",0,
"E'MAX Technology","../diesel/Ema x_tech.htm ",0,
"Product Warranty","../diesel/pdt_w arranty.ht m",0,
"Product Liability","../diesel/pdt_ liability. htm",0,
"Installation Procedure","#",0,
"Diesel Test Report","../diesel/TestRep ort.htm",0 ,
"Customer Reference","../diesel/cust omer_refer ence.htm", 0
)
arMenu3 = new Array(
120,
144,158,
"","",
"","",
"","",
"Our Mission","../emax/mission. htm",0,
"Chairman's Message","../emax/chair.ht m",0,
"About HQ","../emax/hq.htm",0,
"Japan Manufacturing Plant","../emax/mfg.htm",0 ,
"E'MAX Technology","../emax/Emax_ tech.htm", 0,
"Patents","../emax/patent. htm",0
)
arMenu4 = new Array(
120,
144,176,
"","",
"","",
"","",
"Air","../envt/air.htm",0,
"Air Pollution","../envt/pollut e1.htm",0,
"Ozone & Smog","../envt/ozone1.htm" ,0,
"Global Warming","../envt/global1. htm",0,
"Climate Change","../envt/climate.h tm",0,
"Carbon Cycle","../envt/carbon1.ht m",0,
"Engine's Health & Environmental Impacts","../envt/engine_h ealth.htm" ,0,
"Other Links","../envt/otherlinks .htm",0
)
__________________________ __________ __________ ____
View the website created from JScript.
www.emaxenv.com
Hope will help.
Add the tag like this:
<SCRIPT LANGUAGE="JavaScript1.2" SRC="../include/js/mainArr
The mainArrays.js document:
__________________________
arMenu1 = new Array(
120,
144,122,
"","",
"","",
"","",
"Introduction","../petrol/
"S2000 Product Specification","../petrol/
"E'MAX Technology","../petrol/Ema
"Product Warranty","../petrol/pdt_w
"Product Liability","../petrol/pdt_
"Installation Procedure","#",0,
"Petrol Test Report","../petrol/TestRep
"Customer Reference","../petrol/cust
)
arMenu2 = new Array(
120,
144,140,
"","",
"","",
"","",
"Introduction","../diesel/
"Product Specification","../diesel/
"E'MAX Technology","../diesel/Ema
"Product Warranty","../diesel/pdt_w
"Product Liability","../diesel/pdt_
"Installation Procedure","#",0,
"Diesel Test Report","../diesel/TestRep
"Customer Reference","../diesel/cust
)
arMenu3 = new Array(
120,
144,158,
"","",
"","",
"","",
"Our Mission","../emax/mission.
"Chairman's Message","../emax/chair.ht
"About HQ","../emax/hq.htm",0,
"Japan Manufacturing Plant","../emax/mfg.htm",0
"E'MAX Technology","../emax/Emax_
"Patents","../emax/patent.
)
arMenu4 = new Array(
120,
144,176,
"","",
"","",
"","",
"Air","../envt/air.htm",0,
"Air Pollution","../envt/pollut
"Ozone & Smog","../envt/ozone1.htm"
"Global Warming","../envt/global1.
"Climate Change","../envt/climate.h
"Carbon Cycle","../envt/carbon1.ht
"Engine's Health & Environmental Impacts","../envt/engine_h
"Other Links","../envt/otherlinks
)
__________________________
View the website created from JScript.
www.emaxenv.com
Hope will help.
Hi ryancys
Except for size, what is the difference between yours and my code???
Michel
Except for size, what is the difference between yours and my code???
Michel
Hi, mplungian.
Just post something i think correct, nothing else. Ignore my comment if needed.
Just post something i think correct, nothing else. Ignore my comment if needed.
Problem is that quite a number of people would say, hey the comments are the same - let's give the points to the largest post :( Happens all the time - so I tend not to post a similar post unless it is adding to the discussion...
Michel
Michel
mplungjan, ya, thanks for your advice. Maybe i'm too rush to post my comment.
prosoftsolutionsinc,
Some of these questions have been open for some time. Please resolve them appropriately as soon as possible.
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20075980
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20126953
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20129727
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154467
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20228297
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20241042
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Some of these questions have been open for some time. Please resolve them appropriately as soon as possible.
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20075980
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20126953
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20129727
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154467
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20228297
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20241042
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Deletion rejected. Force-accepted by
Netminder
Community Support Moderator
Experts Exchange
Netminder
Community Support Moderator
Experts Exchange
8<--------------cut ------------
// Remember NO html tags in js files
function myFunctionFromJsFile() {
alert('Hello from JS');
}
// end of js file
8<--------------cut ------------
Michel