曲径通幽论坛

标题: 自定义函数的方法 [打印本页]

作者: easy    时间: 2013-4-4 11:02
标题: 自定义函数的方法
自定义一个函数使用下面的形式:
function my_function(参数列表)
函数体
函数名 = 函数的返回值
end function

示例代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<[email=%@LANGUAGE=]%@LANGUAGE="VBSCRIPT[/email]" CODEPAGE="65001" %>
<%
function add_ab(a, b)
dim c
c = a + b

add_ab = c
end function
response.Write("2 + 5 = " & add_ab(2, 5))
%>
</body>
</html>
运行结果:2 + 5 = 7




欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2