Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6990035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:17:35+00:00 2026-05-27T19:17:35+00:00

So I have visual basic code in a classic asp page where I want

  • 0

So I have visual basic code in a classic asp page where I want to get a javascript error message to display if my code reaches a certain point:

<%
Function parseString(inputString){
 'some code
 if startPos > 0 Then
  'some code
 Else
  displaymessage
 End if
}
'more code
%>

<script type ="text/javascript">
    function displaymessage() {
        alert("Wrong!");
    }
</script>

How do I get the displaymessage function to execute at a specific point in my visual basic code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:17:36+00:00Added an answer on May 27, 2026 at 7:17 pm

    You could also do this:

    <%
    Function parseString(inputString)
       if startPos > 0 Then
           '...
       Else
           call displayMessage
       End if
    End Function
    
    Function displayMessage
    %>
        <script type ="text/javascript">
            alert("Wrong!");
        </script>
    <%
    End Function
    %>
    

    But you have to realise that (as Lee said) vb code runs on the server and only after it is done, its result will be sent to the client and there your js code will run. This means that your vb code will not be stopped by this alert. Moreover, this alert may not even display on the client because just blindly writing this piece of javascript code to the response may not result in a valid document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a program in visual basic and want it to display the
I have written this code in visual basic. On executing no error is printed
How can I get Visual Basic to open another form using code? I have
I have a simple text reading code for Visual Basic: Dim fileReader As String
I have some Visual Basic Code that creates a chart for each row. It
I have a collection in Visual Basic.net (Sorry if people are seeing this code
i have a form created using Visual Basic 2008 in c# i want to
I have created an ActiveX control using C++. I use Visual Basic code to
I'm converting Visual Basic.Net code to C# in my project. But I have some
The following code is visual basic, .NET, ASP... all of the above? Can anybody

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.