HLRosenberger
asked on
web.config and javascript libraries
I have a set of javascript functions. I have this statement in each page:
<script language="javascript" type="text/javascript" src="/Scripts/TNCP.js"></s cript>
Is there a way to do this in the web.config so that I don't have to add it to each page?
<script language="javascript" type="text/javascript" src="/Scripts/TNCP.js"></s
Is there a way to do this in the web.config so that I don't have to add it to each page?
I would add it as in a include. Make an include page that just contains your js files to be used on every page and place them there. It is a great way to make a template in asp.
ASKER
can you expand on what an include is?
An include file can be any text, html, asp file.
Your page would look like below with only your js files. I would do the same with css files, header and footer.
/INCLUDES/JS.ASP
http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
Your page would look like below with only your js files. I would do the same with css files, header and footer.
/INCLUDES/JS.ASP
<script src="/Scripts/TNCP.js"></script>
<script src="/Scripts/foo.js"></script>
<script src="/Scripts/bar.js"></script>
INDEX.ASP<!DOCTYPE html>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<html>
<!-- #include virtual file ="/includes/js.asp" -->
<head>
<meta charset="utf-8">
<title>padas</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<html>
<!-- #include virtual file ="/includes/css.asp" -->
<!-- #include virtual file ="/includes/js.asp" -->
<head>
<meta charset="utf-8">
<title>padas</title>
</head>
<body>
<!-- #include virtual file ="/includes/header.asp" -->
<!-- #include virtual file ="/includes/footer.asp" -->
</body>
</html>
http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
ASKER
bear with me, but I'm not quite following. This statement in my page:
<script language="javascript" type="text/javascript" src="/Scripts/TNCP.js"></s cript>
tells the system to pull in the javascript in the TNCP.JS file and make it available to the page, correct? So that's sort of like an include. I'm looking for a way to do this globally, for the whole project, and not page by page. I want my library of javascript functions available on every page. Does that make sense?
Are you saying I can create one include file that has an include directive that will pull in the TNCP.JS file for all pages?
<script language="javascript" type="text/javascript" src="/Scripts/TNCP.js"></s
tells the system to pull in the javascript in the TNCP.JS file and make it available to the page, correct? So that's sort of like an include. I'm looking for a way to do this globally, for the whole project, and not page by page. I want my library of javascript functions available on every page. Does that make sense?
Are you saying I can create one include file that has an include directive that will pull in the TNCP.JS file for all pages?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks