tags:

views:

26

answers:

1

Hello,

I have a VBScript function in my ASP.net Page I have a small test function as shown below

<script type="text/vbscript">
     sub testmePlease()
            msgbox("Hello World")
        end sub
</script>

I have a button in my webform and I am calling the function onclientclick as shown below

<asp:Button ID="btnAccept" runat="server" Text="Accept Settlement" OnClientClick="testmePlease()"/> 

For some reason I get this end of statement expected javascipt error. What can be wrong??

+1  A: 

I'm assuming you're using IE. Once Internet Explorer finds first <script> tag in your page, it assumes it's language as default.

Try this:

<script type="text/javascript">var foobar = false;</script>
<script type="text/vbscript">
   sub testmePlease()
          msgbox("Hello World")
   end sub
</script>

And change your button to:

<asp:Button ID="btnAccept" runat="server" 
            Text="Accept Settlement"
            OnClientClick="return testmePlease()"/> 

Everything else should run ok.

Rubens Farias
Great. It worked. Thank you
acadia