SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dialog box in order to get determinated....

    I want to tell me a way to create a pop up window which cannot be closed be the user except to press yes or no.

    I want it in order to determinated if a file upload form will be shown in a form or not.

    For example the pop up will say

    Would you like to upload an image?
    If user press yes, then an upload form will be created among others which are being created statically.

    Is that possible?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just do the normal confirm(). If they X it off, it returns false.

    It doesn't have yes or no though, only Ok and Cancel. If you want Yes/No, use VBS.


    <html>
    <head>
    <script language="VBScript">
    function vbconfirmbox(thismsg,thisstyle)
    vbconfirmbox = MsgBox(thismsg,thisstyle)
    End function
    </script>

    <script language="JavaScript">
    function askme(){
    result = vbconfirmbox('Are You Sure?',32 + 4)
    // in this case result can be 6 or 7.
    if (result==6){
    alert("Your answer is Yes")
    }else{
    alert("Your answer is No")
    }
    }
    </script>
    </head>
    <body>
    <input type="button" value="ask me" onClick="askme()">
    </body>
    </html>

    and i have to explain what is "32 + 4"

    0 Show OK button (VBOKOnly)
    1 Show OK and cancel buttons (VBOKCancel)
    2 Show abort, retry, ignore buttons (VBAbortRetryIgnore)
    3 Show yes, no cancel buttons (VBYesNoCancel)
    4 Show yes, no buttons (VBYesNo)
    5 Show retry, cancel buttons (VBRetryCancel)

    16 Show critical message icon (VBCritical)
    32 Show warning query button (VBQuestion)
    48 Show warning message icon (VBExclamation)
    64 Show information message icon (VBInformation)

    0 First button is default (VBDefaultButton1)
    256 Second button is default (VBDefaultButton2)
    512 Third button is default (VBDefaultButton3)
    768 Fourth button is default (VBDefaultButton4)

    .. in my example, it shows "Yes" and "No" buttons(4) with "warning query button". and default is first button(0)..

    and regarding to selected method, returning values could be;
    1 OK
    2 Cancel
    3 Abort
    4 Retry
    5 Ignore
    6 Yes
    7 No
    -Mark

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, but i want this dialog box to rise when i enter the html page and then some php statements occur in proportion the value of Ok or Cancel

    Could you give me an example because i am unaware of javascript, and a relevant tutorial would be useful too!

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't do it exactly how you're wanting. Javascript is clientside, php is serverside. BUT, you can do this

    Code:
    function checkOk() {
      if (confirm('Press Ok if you like pizza!')) {
        window.location='likespizza.html';
      } else {
        window.location='doesnotlikepizza.html';
      }
    }
    window.onload=checkOk();

    I don't know of any tutorials really. Most of what I know, which isn't a whole lot really, is from writing a PHP chat program and just gathering info from other websites that had similar stuff to what I needed.
    -Mark

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i wrote that

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <!-- Creation Date: 17/12/2002 -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Generator" content="Dev-PHP 1.3.0">
    <title>Document Title</title>
    <script language="javascript"
    function checkOk() {
    if (confirm('Press Ok if you like pizza!')) {
    window.location='likespizza.html';
    } else {
    window.location='doesnotlikepizza.html';
    }
    }
    window.onload=checkOk();
    </script>


    </head>
    <body>


    </body>
    </html>


    and i opened by a broswer but nothing
    Where is my wrong?

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    forgot the > on the <script language="javascript">
    -Mark


Bookmarks

Posting Permissions

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