Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    202

    Unanswered: How to use msgbox in ASP

    Hi,

    Can u please tell me how to use message box command which we normally use in visual basic in ASP?
    Thanx

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you mean using a javascript alert box so the client gets a standard message box type thing??

    basically you get your server side script to write some client side script. what exactly are you trying to achieve though as there are different ways to do this type on thing depending on your requirements....

  3. #3
    Join Date
    Mar 2004
    Posts
    202
    Originally posted by rokslide
    you mean using a javascript alert box so the client gets a standard message box type thing??

    basically you get your server side script to write some client side script. what exactly are you trying to achieve though as there are different ways to do this type on thing depending on your requirements....
    Hi there,

    Well, i just need a msg boz to pop up in the login interface when the user enter the right password which has been validated in a processing form which is in vbscript.So when i'm in the processing form, i need a msgbox to pop in the login interface which state Invalid User and need the user to type again.
    Thanx

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Normally with an error message like this in asp you would write the error out the the page itself and not use a pop up message box....

    If you really want to use a popup message box you want to force a javascript function to be called when the page loads...

    You can do this by adding a page onload event to the body element of your webpage and have a javascript function which uses alert to pop up a message...

    eg
    Code:
    <html>
      <head>
        <script language="javascript">
        function showMessage(){
          alert("Your login failed");
        }
        </script>
      <head>
      <body onload="showMessage();">
        ... your page in here ...
      </body>
    </html>
    in your asp you will have to determine if the login failed then write the onload section if it is needed.

  5. #5
    Join Date
    Mar 2004
    Posts
    202
    Originally posted by rokslide
    Normally with an error message like this in asp you would write the error out the the page itself and not use a pop up message box....

    If you really want to use a popup message box you want to force a javascript function to be called when the page loads...

    You can do this by adding a page onload event to the body element of your webpage and have a javascript function which uses alert to pop up a message...

    eg
    Code:
    <html>
      <head>
        <script language="javascript">
        function showMessage(){
          alert("Your login failed");
        }
        </script>
      <head>
      <body onload="showMessage();">
        ... your page in here ...
      </body>
    </html>
    in your asp you will have to determine if the login failed then write the onload section if it is needed.
    HI

    If i put in this code, wouldn't it pop up everytime i load the page.
    If i load the page for the first time to key in my user name and password, thel logical flow to it would be wrong rite.I just wan the msgbox to pop up after i key in an invalid username or password which is processed in other file.
    Please help
    Thanx

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    like I said
    in your asp you will have to determine if the login failed then write the onload section if it is needed.
    so to expand for those who need it....
    Code:
    <html>
      <head>
        <script language="javascript">
        function showMessage(){
          alert("Your login failed");
        }
        </script>
      <head>
    <%if mylogin = false then%>
      <body onload="showMessage();">
    <%else%>
        <body>
    <%end if%>
        ... your page in here ...
      </body>
    </html>

  7. #7
    Join Date
    Mar 2004
    Posts
    202
    Thanx.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •