ASP Procedures

Programming/ASP 2008. 1. 10. 17:42
Differences Between VBScript and JavaScript
  • VBScript 로 구성된 ASP 파일로부터 VBScript 또는 JavaScript 프로시저를 호출하려고 할 때, 프로시저 이름에 call 키워드를 사용 할 수 있다.
    프로시저가 파라미터를 요구한다면, 파라미터 리스트는 call 키워드를 사용하여 괄호안에 넣어야 한다.
    call 키워드를 생략하려면, 파라미터 리스트는 괄호에 넣지 말아야 한다.
    파라미터가 없는 프로시저에서, 괄호는 선택이다.
  • JavaScript로 구성된 ASP 파일로부터 JavaScript 또는 VBScript 프로시저를 호출하려고 할 때, 항상 프로시저 이름 뒤에 괄호를 사용한다.

ex1) VBScript 를 사용한 프로시저 호출
: ASP로부터 VBScript를 호출하는 방법
<html>
<head>

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


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

ex2) JavaScript 를 사용한 프로시저 호출
: ASP로부터 JavaScript를 호출하는 방법
<%@ language="javascript" %>
<html>
<head>

<%
function jsproc(num1,num2)
{
  Response.Write(num1*num2)
}
%>


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

ex3) VBScript를 사용한 프로시저 호출
: ASP 파일에서 VBScript 프로시저와 JavaScript 프로시저를 둘다 호출하는 방법
<html>
<head>

<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
end sub
%>


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


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


WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,