1

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.