Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    42
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question javascript alert

    hi
    i was wondering if there was anyway to take this code and make it so when you click ok it will take you to a url and also how can i add a cancel button thanks.
    PHP Code:
    <script language="javascript">
                
    alert("You have a chat invitation. Please goto 'Chat Partners Online!'");
            
    </script> 

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This should do it.

    if (confirm("Do you want to go?")) window.location.href = "http://www.google.com";

    david_kw

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    42
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Thumbs up

    hi
    thanks a lot that works

  • #4
    New Coder
    Join Date
    Jan 2007
    Posts
    42
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question

    is there away to make this code open a new page?
    PHP Code:
    if (confirm("Do you want to go?")) window.location.href "http://www.google.com"

  • #5
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try

    if (confirm("Do you want to go?")) window.open("http://www.google.com", "NewWin");

    see this link for information on window.open

    http://www.javascript-coder.com/wind...dow-open.phtml

    david_kw

  • #6
    New Coder
    Join Date
    Jan 2007
    Posts
    42
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Thumbs up

    again thank you!!


  •  

    Posting Permissions

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