SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: confirm code

  1. #1
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    confirm code

    i have this code, when i press ok how can i make a popup box appear:

    <script language="JavaScript">
    <!--
    function confirm_entry()
    {
    input_box=confirm("Username has requested a private chat!");
    if (input_box==true)

    {
    // Output when OK is clicked
    alert ("You clicked OK");
    }

    else
    {
    // Output when Cancel is clicked
    alert ("You clicked cancel");
    }

    }
    -->
    </script>
    Click <a href="JavaScript:confirm_entry()">here</a>

    also i want to get rid of Click <a href="javascript:confirm_entry()">here</a> so when the page loads it automaticaly shows the confirm box.
    Animated Chatrooms - www.121chatrooms.net

  2. #2
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you can add onLoad="javascript:confirm_entry()" or similar into the opening <body> tag...

  3. #3
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any other tags apart from that 1?
    Animated Chatrooms - www.121chatrooms.net

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or,

    Code:
    window.onload = confirm_entry;
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)


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
  •