I am trying to run an asp page with an external JavaScript file but it is showing error like this....

Error Type:
Active Server Pages, ASP 0124 (0x80004005)
The required Language attribute of the Script tag is missing.
/ew-ii-as-8/testserverwithEJSF.asp, line 3

My both files are...

TestServerWithEJSF.asp

<html>
<head>
<script type="text/javascript" runat="server" src="EJSF.js"></script>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2);
call jsproc(5,20);
end sub
%>
</head>

<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>

</html>

EJSF.js

function jsproc(num1,num2)
{
Response.Write("<br>Result :");
Response.Write(num1*num2);
}

But, when I run the asp page puting JavaScript codes into the asp page then it is running well in my server as well as clint machine. The codes of the asp page are..

TestServer.asp

<html>
<head>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
call jsproc(5,20)
end sub
%>

<script  language="javascript" runat="server">
function jsproc(num1,num2)
{
Response.Write("<br>Result :");
Response.Write(num1*num2);
}
</script>
</head>

<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>

</html>

I am unable to understand how to run the asp page with an external JavaScript file which is running at asp server. Please guide me Sir/Madam.

Get rid of the runat="server"
add language="javascript"

Dear Vsmash,

I am sorry, I have not understood, what you mean to say. Could you please explain little more? And have you tried my "TestServerWithEJSF.asp" & "EJSF.js" file's codes?

Thanks.

Okay so your asp stuff is processed by the server before output but your javascript stuff is not. It is processed by the client browser.

Your vbproc should have no semi colons as line endings and your call to external javascrpt should not have runat="server" and it should have a language specification

TestServerWithEJSF.asp:

<html>
<head>
<script type="text/javascript" language="javascript" src="EJSF.js"></script>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
call jsproc(5,20)
end sub
%>
</head>

<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>

</html>

Your external javascript is javascrpt and should have document.write rather than response.write

EJSF.js

function jsproc(num1,num2)
{
document.Write("<br>Result :");
document.Write(num1*num2);
}

If you combine to one page it should look like this:
TestServer.asp

<html>
<head>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
call jsproc(5,20)
end sub
%>

<script  language="javascript" type="text/Javascript">
function jsproc(num1,num2)
{
document.Write("<br>Result :");
document.Write(num1*num2);
}
</script>
</head>

Dear VSMASS,

Thanks for your reply with explanation.

As you have suggested with the file name TestServer.asp, this codes are not working (but as I have mentioned earlier that this file's codes as I have written was working for me) showing error like this...

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'jsproc'
/ew-ii-as-8/TestServerVSMASS.asp, line 6

And suggested with the file name TestServerWithEJSF.asp and EJSF.js, these codes are also not working showing error like this...

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'jsproc'
/ew-ii-as-8/TestServerWithEJSFVSMASS.asp, line 7

But, when I have tested my original codes of "TestServerWithEJSF.asp" file with little modification as below, it is working well in both server and client machine. Only your two suggestion have work for me, one is "semicolon" (this was my mistake) and other is "language specification". But not other suggestions.

<html>
<head>
<script type="text/javascript" [B]language="javascript"[/B] runat="server"  src="EJSF.js"></script>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
call jsproc(5,20)
end sub
%>

</head>

<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>

</html>

Javascript file EJSF.js

function jsproc(num1,num2)
{
Response.Write("<br>Result :");
Response.Write(num1*num2);
}

Thanks again, and here I am closing this thread as it has solved my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.