B
Bruce
Can anyone tell me why this doesn't work?
My end goal here is to be able to write Javascript library modules that
can be used by both client and server side code. My test here consists
of 2 files:
testGlobal.asp :
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="JavaScript" type="text/javascript" runat="server"
src="testGlobal.js"></script>
<%
Response.Write("Global value=" + testGlobal());
%>
testGlobal.js :
var globalVal = "5";
function testGlobal() {
return globalVal;
} /* end of testGlobal */
My problem is that when I call testGlobal() from the server side,
globalVal is undefined. If I move it inside the function, all is well.
Why can't testGlobal() see the variable globalVal ?
Thanks,
My end goal here is to be able to write Javascript library modules that
can be used by both client and server side code. My test here consists
of 2 files:
testGlobal.asp :
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="JavaScript" type="text/javascript" runat="server"
src="testGlobal.js"></script>
<%
Response.Write("Global value=" + testGlobal());
%>
testGlobal.js :
var globalVal = "5";
function testGlobal() {
return globalVal;
} /* end of testGlobal */
My problem is that when I call testGlobal() from the server side,
globalVal is undefined. If I move it inside the function, all is well.
Why can't testGlobal() see the variable globalVal ?
Thanks,