- VBScript 教程
- VBScript - 首頁
- VBScript - 概述
- VBScript - 語法
- VBScript - 啟用
- VBScript - 佈局
- VBScript - 變數
- VBScript - 常量
- VBScript - 運算子
- VBScript - 決策
- VBScript - 迴圈
- VBScript - 事件
- VBScript - Cookie
- VBScript - 數字
- VBScript - 字串
- VBScript - 陣列
- VBScript - 日期
- VBScript 高階
- VBScript - 過程
- VBScript - 對話方塊
- VBScript - 面向物件
- VBScript - 正則表示式
- VBScript - 錯誤處理
- VBScript - 雜項語句
- VBScript 實用資源
- VBScript - 問題和答案
- VBScript - 快速指南
- VBScript - 實用資源
- VBScript - 討論
VBScript ByRef 引數
什麼是 ByRef 引數?
如果指定了 ByRef,在呼叫函式或過程時,引數將作為引用傳送。
示例
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Function fnadd(ByRef num1, ByRef num2)
num1 = 4
num2 = 5
End Function
Dim x,y
x = 6
y = 4
res = fnadd(x,y)
document.write("The value of x is " & x & "<br />")
document.write("The value of y is " & y & "<br />")
</script>
</body>
</html>
以上函式將 x 和 y 引數作為引用使用。因此,執行函式後,值將發生改變。
如果以上函式被儲存為 .html 格式並使用 IE 執行,輸出結果如下:
The value of x is 4 The value of y is 5
vbscript_procedures.htm
廣告