📄 asp_procedures.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP Procedures</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ASP Procedures</h1>
<a href="asp_variables.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_inputforms.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">In ASP you can call a JavaScript procedure from a VBScript and vice versa. </p>
<hr />
<h2>Examples </h2>
<p><a target="_blank" href="showasp.asp@filename=demo_vbproc">Call a procedure using VBScript</a><br />
How to call a VBScript procedure from ASP.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_jsproc">Call a procedure using JavaScript</a><br />
How to call a JavaScript procedure from ASP.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_vbproc2">Call procedures using VBScript</a><br />
How to call both a JavaScript procedure and a VBScript procedure in an ASP file.</p>
<hr />
<h2>Procedures </h2>
<p>The ASP source code can contain procedures and functions: </p>
<table width="100%" border="1" class="ex" cellspacing="0"><tr><td>
<pre><html>
<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head></pre>
<pre><body>
<p>Result: <%call vbproc(3,4)%></p>
</body></pre>
<pre></html></pre>
</td></tr></table>
<p>Insert the <%@ language="<i>language</i>" %> line above the
<html> tag to write procedures or functions in another scripting language
than
default: </p>
<table width="100%" border="1" class="ex" cellspacing="0"><tr><td>
<pre><%@ language="javascript" %>
<html>
<head>
<%
function jsproc(num1,num2)
{
Response.Write(num1*num2)
}
%>
</head></pre>
<pre><body>
<p>Result: <%jsproc(3,4)%></p>
</body></pre>
<pre></html></pre>
</td></tr></table>
<br />
<hr />
<h2>Differences Between VBScript and JavaScript</h2>
<p>When calling a VBScript or a JavaScript procedure from an ASP file written in VBScript, you can use the
"call" keyword followed by the procedure name. If
a procedure requires
parameters, the parameter list must be enclosed in parentheses when using the
"call" keyword. If you omit the "call" keyword, the
parameter list must not be enclosed in parentheses. If the procedure has no
parameters, the parentheses are optional. </p>
<p>When calling a JavaScript or a VBScript procedure from an ASP file written in
JavaScript,
always use parentheses after the procedure name. </p>
<hr />
<a href="asp_variables.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_inputforms.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -