If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to use msgbox in ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-04, 23:45
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
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
Reply With Quote
  #2 (permalink)  
Old 04-13-04, 23:50
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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....
Reply With Quote
  #3 (permalink)  
Old 04-14-04, 00:00
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Quote:
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
Reply With Quote
  #4 (permalink)  
Old 04-14-04, 01:13
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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.
Reply With Quote
  #5 (permalink)  
Old 04-14-04, 02:03
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Quote:
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
Reply With Quote
  #6 (permalink)  
Old 04-14-04, 02:10
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
like I said
Quote:
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>
Reply With Quote
  #7 (permalink)  
Old 04-14-04, 02:15
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Thanx.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On