网站建设咨询电话
首页 >> 新闻中心 >> 新闻中心 >文章列表

VBScript入门代码示例 VBSscript过程:Sub过程和Function 过程

发布时间:2008-1-14 15:02:40   来源:正佳科技  编辑:佚名

没有参数的VBScript Sub过程代码示例

<html>
<head>
<title>没有参数的 VBScript Sub 过程代码示例</title>
<script type="text/vbscript">
sub myProc()
msgbox "欢迎来到正佳科技 www.kingar.com"
end sub
</script>
</head>

<body>
<script type="text/vbscript">
call myProc()
</script>
<p>VBScript Sub 过程不返回值。</p>

</body>
</html>

演示结果:

www.kingar.com

带参数的VBScript Sub过程代码示例

<html>
<head>
<title>VBScript Sub 过程代码示例</title>
<script type="text/vbscript">
Sub myMulti(no1, no2)
MsgBox (no1*no2)
End Sub
</script>
</head>
<body>

<script  type="text/vbscript">
myMulti 8,9
</script>

</body>
</html>

演示结果:72

用Call语句调用VBScript Sub过程代码示例

<html>
<head>
<title>VBScript Sub 过程代码示例</title>
<script type="text/vbscript">
Sub myMulti(no1, no2)
MsgBox (no1*no2)
End Sub
</script>
</head>
<body>

<script  type="text/vbscript">
call myMulti(8,9)
</script>

</body>
</html>

演示结果:72

VBScript Function 过程代码示例

<html>
<head>
<title>VBScript Function 过程代码示例</title>
<script type="text/vbscript">
Function myMulti(no1, no2)
myMulti = no1*no2
End Function
</script>
</head>
<body>

<script  type="text/vbscript">
dim vNo
vNo = myMulti(8,9) + 100
MsgBox vNo
</script>

</body>
</html>

 演示结果:172

* 姓  名:
更多资料  了解方案 
* 单位名称:
* 联系电话:
* 电子邮件: