日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ASP 子程序

發(fā)布時間:2025/7/14 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ASP 子程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在 ASP 中,你可通過 VBScript 和其他方式調用子程序。

實例:

調用使用 VBScript 的子程序
如何從 ASP 調用以 VBScript 編寫的子程序。 <html><head> <% sub vbproc(num1,num2) response.write(num1*num2) end sub %> </head><body> <p>您可以像這樣調用一個程序:</p> <p>結果:<%call vbproc(3,4)%></p><p>或者,像這樣:</p> <p>結果:<%vbproc 3,4%></p> </body></html>
調用使用 JavaScript 的子程序
如何從 ASP 調用以 JavaScript 編寫的子程序。 <%@ language="javascript" %> <html> <head> <% function jsproc(num1,num2) { Response.Write(num1*num2) } %> </head><body> <p> 結果:<%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>結果:<%call vbproc(3,4)%></p> <p>結果:<%call jsproc(3,4)%></p> </body></html>

子程序

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 子程序時,必須在子程序名后使用括號。

轉載于:https://www.cnblogs.com/xiaoxingchi/archive/2010/01/18/1651089.html

總結

以上是生活随笔為你收集整理的ASP 子程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。