为什么只显示body里的内容 而reverse()函数没执行?<HTML>
<HEAD><TITLE>函数使用举例 反转字符串</TITLE>
<SCRIPT LANGUAGE="VBScript">Fuction reverse(oldstr)
    Dim l,rever
    l=Len(oldstr)
    rever=""
    For i=1 to l
       ch=Mid(oldstr,l-i+1,l)
       rever=rever&ch
    Next
    reverse=rever
End FunctionSub ShowReverse
    Dim oldstr,newstr
    oldstr=InputBox("请输入一个字符串:","字符串翻转")
    newstr=reverse(oldstr)
    MsgBox "输入的字符串为:" &oldstr&char(13)&chr(10)_
    &"转换后的字符串为:"&newstr
End Sub
call ShowReverse() '调用ShowReverse过程
</SCRIPT> 
</HEAD>
<BODY>……
</BODY>
</HTML>

解决方案 »

  1.   

    没出错提示额  我是在ie运行的 用的是 iis6 
      

  2.   


    <SCRIPT LANGUAGE="VBScript"> Fuction reverse(oldstr) <----------低级错误 Function 少了个n
        Dim l,rever 
        l=Len(oldstr) 
        rever="" 
        For i=1 to l 
          ch=Mid(oldstr,l-i+1,l) 
          rever=rever&ch 
        Next 
        reverse=rever 
    End Function Sub ShowReverse 
        Dim oldstr,newstr 
        oldstr=InputBox("请输入一个字符串:","字符串翻转") 
        newstr=reverse(oldstr) 
        MsgBox "输入的字符串为:" &oldstr&char(13)&chr(10)_ 
        &"转换后的字符串为:"&newstr 
    End Sub 
    call ShowReverse() '调用ShowReverse过程 
    </SCRIPT> 
      

  3.   

     ShowReverse 又没执行?
      

  4.   

    只执行了 
        Sub ShowReverse
        Dim oldstr,newstr
        oldstr=InputBox("请输入一个字符串:","字符串翻转")
    MsgBox 没执行?
      

  5.   

    问题好多,呵呵<HTML>
    <HEAD> <TITLE>函数使用举例 反转字符串 </TITLE>
    <SCRIPT  type="text/vbscript">Function reverse(oldstr)
        Dim m, rever, ch
        m = Len(oldstr)
        rever = ""
        For i = m to 1
          ch = Mid(oldstr,  i , 1)
          rever = rever & ch
        Next
        reverse = rever
    End FunctionSub ShowReverse()
        Dim oldstr, newstr
        oldstr = InputBox("请输入一个字符串:","字符串翻转")
        newstr = reverse(oldstr)
        MsgBox "输入的字符串为:" & oldstr & Chr(13) & Chr(10) & "转换后的字符串为:" & newstr
    End Sub</SCRIPT>
    </HEAD>
    <BODY>
    <script  type="text/vbscript">
    call ShowReverse
    </script>
    ……
    </BODY>
    </HTML>
      

  6.   

    还不行额 我在body里加入call ShowReverse 后 要提示两次输入字符串
    是不是我 iis 配置的问题啊
    我是初学者哈 ,大家不要介意哈!
      

  7.   

    修改一下<HTML>
    <HEAD> <TITLE>函数使用举例 反转字符串 </TITLE>
    <SCRIPT  type="text/vbscript">Function reverse(oldstr)
        Dim m, rever, ch    m = Len(oldstr)
        rever = ""    For i = m to 1 step -1
          ch = Mid(oldstr,  i , 1)
          rever = rever & ch
        Next    reverse = rever
    End FunctionSub ShowReverse()
        Dim oldstr, newstr
        oldstr = InputBox("请输入一个字符串:","字符串翻转")
        newstr = reverse(oldstr)
        MsgBox "输入的字符串为:" & oldstr & Chr(13) & Chr(10) & "转换后的字符串为:" & newstr
    End Sub</SCRIPT>
    </HEAD>
    <BODY>
    <script  type="text/vbscript">
    call ShowReverse
    </script>
    ……
    </BODY>
    </HTML>
      

  8.   

    还是没显示出来 MsgBox 是不是什么没配置好啊?
    我用的是sever2003  首先我在记事本写下代码然后保存成asp文件 在ie8输入 localhost/reversestr.asp
    <HTML>
    <HEAD><TITLE>函数使用举例 反转字符串</TITLE>
    <SCRIPT type="text/vbscript">Function reverse(oldstr)
        Dim m,rever,ch
        m=Len(oldstr)
        rever=""
        For i = m to 1 step -1
           ch = Mid(oldstr,i,l)
           rever = rever & ch
        Next
        reverse = rever
    End FunctionSub ShowReverse()
        Dim oldstr,newstr
        oldstr = InputBox("请输入一个字符串:","字符串翻转")
        newstr = reverse(oldstr)
        MsgBox "输入的字符串为:" & oldstr & char(13)& chr(10) & "转换后的字符串为:" & newstr
    End Sub</SCRIPT> 
    </HEAD>
    <BODY>……
    <script type="text/vbscript">
    call ShowReverse
    </script>
    </BODY>
    </HTML>
      

  9.   

    上帝啊 我终于找到错哪了 
    MsgBox "输入的字符串为:" & oldstr & char(13)& chr(10) & "转换后的字符串为:" & newstr chr 拼写错误 
    汗!
    感谢各位学长们的指点哈