比较:
这样写就没有语法错误
- VBScript code
<script type="text/vbscript"> function MyProc(sum) a=1 b=2 c=a+b sum=document.write(c) return(sum) end function </script> <script type="text/vbscript"> MyProc(sum) </script>
这样写代码就无法执行?
- VBScript code
<script type="text/vbscript"> function MyProc(c) a=1 b=2 c=a+b return(c) end function </script> <script type="text/vbscript"> document.write(MyProc(c)) </script>
本人菜鸟,麻烦详细说明语法错误原因,还有为什么document.write不能放在调用函数的外面执行?
------解决方案--------------------
vbs函数返回值不是 rfeturn, 是用 函数名=值 的形式
- HTML code
<script type="text/vbscript"> function MyProc(c) a=1 b=2 c=a+b MyProc=c end function </script> <script type="text/vbscript"> document.write(MyProc(c)) </script>
------解决方案--------------------
你第二个的return(c)改为MyProc=c
就可以了。
------解决方案--------------------
下面说得很明白,就是这样。