Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javaScript and ASP Script 1

Status
Not open for further replies.

guineamation

Programmer
Jan 29, 2002
58
IL
can a JS function can be called from an ASP Script?
 
you can do a
Code:
<script>
<%
if something=something then
response.write "call your function here"

else
response.write "call a different function here"

end if

%>
</script>

but technically you can't because javascript is client-side and asp is server-side
 
i gave u a star because u almost always answer my posts and your answers are right on the money!

Thanks!
 
for js i believe you can use the <%@ language="javascript" %>
at the very top of the page and call it that way....otherwise...you can use vbs like this
Code:
<html>

<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head>

<body>
<p>
You can call a procedure like this:
</p>
<p>
Result: <%call vbproc(3,4)%>
</p>
<p>
Or, like this:
</p>
<p>
Result: <%vbproc 3,4%>
</p>
</body>

</html>

js example

Code:
<%@ language="javascript" %>
<html>
<head>
<%
function jsproc(num1,num2)
{
Response.Write(num1*num2)
}
%>
</head>

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

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top