Hi, throw the following example into a text file, save with an ASP extension, and execute it in IIS6/7. Can anyone explain why Test 1 works fine, and Test 2 returns undefined? Is it something to do with variable scope?
Thanks,
Iain
<%@ language="javascript"%>
<script type="text/javascript" language="JScript" runat="server">
function myFunction() {return 'Hello Functional World'};
var myVariable = 'Hello Variable World';
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns=" lang="en">
<head>
<title>Test</title>
</head>
<body>
<% Response.Write('Test 1: ' + myFunction());%>
<br />
<% Response.Write('Test 2: ' + myVariable);%>
</body>
</html>
Thanks,
Iain
<%@ language="javascript"%>
<script type="text/javascript" language="JScript" runat="server">
function myFunction() {return 'Hello Functional World'};
var myVariable = 'Hello Variable World';
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns=" lang="en">
<head>
<title>Test</title>
</head>
<body>
<% Response.Write('Test 1: ' + myFunction());%>
<br />
<% Response.Write('Test 2: ' + myVariable);%>
</body>
</html>