#1
  1. No Profile Picture
    flashing vampire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    nowhere
    Posts
    19
    Rep Power
    0

    msgbox for ASP ?


    i found this function msgbox in VBScript contents of my book but when i write somthing with it the browser report an error, is that because msgbox function couldnt be available for ASP ?

    Regards~
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,449
    Rep Power
    4539
    msgbox will need to run on the client browser, not in server-side asp code.
  4. #3
  5. No Profile Picture
    flashing vampire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    nowhere
    Posts
    19
    Rep Power
    0

    Question


    thanx for quick reply~

    ok i insert code block into Html page but still reponds nothing, the code is right below, i'd appreciate of any advice.
    PHP Code:
    <script language="vbscript">
    dim msg "test~"
    MsgBox msg
    </script>
     
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,449
    Rep Power
    4539
    VBScript is supported by Internet Explorer, but most other browsers will not execute VBScript.

    Also, in asp you can't dim msg = "test-"


    You dim msg
    msg = "test"
    msgbox msg
  8. #5
  9. No Profile Picture
    Average Intelligence
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2003
    Location
    Ohio/Chicago
    Posts
    678
    Rep Power
    12
    Oh but think of all the poor netscape users! (no really, just think about them and how bad it must be to use netscape ahem, anyways.....meanwhile, welcome to javascript which is widely supported, use these

    <script>
    confirm('blah')
    alert('blah')
    prompt('blah')
    </script>

    just as easy!
  10. #6
  11. No Profile Picture
    flashing vampire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    nowhere
    Posts
    19
    Rep Power
    0
    Originally posted by Doug G
    VBScript is supported by Internet Explorer, but most other browsers will not execute VBScript.

    Also, in asp you can't dim msg = "test-"


    You dim msg
    msg = "test"
    msgbox msg
    i modified code into this and still got an error:
    PHP Code:
    <%
        
    dim msg
        msg 
    "test~"
        
    MsgBox(msg)
    %> 
    the browser reports Microsoft VBScript running error (0x800A0046)
  12. #7
  13. Monkey Magic
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    UK
    Posts
    103
    Rep Power
    13
    Hi Black

    you need to drop the ASP quotes and add the script command around the code.

    ie.

    Code:
    <SCRIPT LANGUAGE="VBScript">
        dim msg
        msg = "test~"
        MsgBox(msg)
    </SCRIPT>


    Kong.
  14. #8
  15. No Profile Picture
    flashing vampire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    nowhere
    Posts
    19
    Rep Power
    0
    i got it ! thanx kkong


  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    how design message box with yes or no buttons in asp


    hi

    it may simple inside of script tag declare a variable and assign the conform box for the variable. check it yes mean write action code in if condition it process if no write code in else part .


    Sample:

    <script>

    function fun()
    {
    var con=confirm("Are u sure u want process")
    if(con==true)
    {
    ----------
    ----------
    ----------
    ----------

    }
    else
    {
    --------
    --------
    ---------
    }
    </script>
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    120
    Rep Power
    10
    Originally Posted by Aravind Udaiyar
    hi

    it may simple inside of script tag declare a variable and assign the conform box for the variable. check it yes mean write action code in if condition it process if no write code in else part .


    Sample:

    <script>

    function fun()
    {
    var con=confirm("Are u sure u want process")
    if(con==true)
    {
    ----------
    ----------
    ----------
    ----------

    }
    else
    {
    --------
    --------
    ---------
    }
    </script>
    I want to mention only one thing. Not every browser support vbscript, javasript in this case more usefull and has the same alre confirm prompt functionality
  20. #11
  21. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,449
    Rep Power
    4539
    Hey, in case y'all didn't notice this is a 10-year old thread
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  22. #12
  23. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Location
    deerfield florida
    Posts
    8
    Rep Power
    0

    ASP Msgbox function


    Hello friends,
    ASP doesnt have a message box function. If you want one you will have to do something similar to the following:

    1)
    string strMessage = "Your message here";

    StringBuilder sb = new StringBuilder("");
    sb.Append("");
    sb.AppendFormat("alert("{0}");", strMessage);
    sb.Append("")

    Page.RegisterClientScript("AlertScript", sb.ToString());

IMN logo majestic logo threadwatch logo seochat tools logo