国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

學習ASP中子程序的應用

2024-05-04 11:07:20
字體:
來源:轉載
供稿:網友
調用使用VBScript的子程序
如何從ASP調用以VBScript編寫的子程序。
 <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>
調用使用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>
調用使用VBScript和JavaScript的子程序
如何在一個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>      學習ASP中子程序的應用之ASP基礎教程

子程序

ASP源代碼可包含子程序和函數:

<html> <head><%sub vbproc(num1,num2)response.write(num1*num2)end sub%></head><body><p>Result: <%call vbproc(3,4)%></p></body></html>

將<%@ language="language" %>這一行寫到<html>標簽的上面,就可以使用另外一種腳本語言來編寫子程序或者函數:

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

VBScript與JavaScript之間的差異

     當從一個用VBScript編寫的ASP文件中調用VBScript或者JavaScript子程序時,可以使用關鍵詞"call",后面跟著子程序名稱。假如子程序需要參數,當使用關鍵詞"call"時必須使用括號包圍參數。假如省略"call",參數則不必由括號包圍。假如子程序沒有參數,那么括號則是可選項。

    當從一個用JavaScript編寫的ASP文件中調用VBScript或者JavaScript子程序時,必須在子程序名后使用括號。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 上栗县| 京山县| 宜黄县| 家居| 慈溪市| 修文县| 宁武县| 潮州市| 泸溪县| 井陉县| 陈巴尔虎旗| 江都市| 周宁县| 普兰店市| 且末县| 清涧县| 德兴市| 会东县| 商都县| 西畴县| 深泽县| 平顺县| 甘德县| 凤城市| 江津市| 从化市| 邵东县| 工布江达县| 旌德县| 鄱阳县| 阜新| 白河县| 诸城市| 翼城县| 深圳市| 镇安县| 礼泉县| 开江县| 荆州市| 集贤县| 屯昌县|