SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS Alert/popup with link and new target window?

    I have been fiddling with scripts all morning trying to do the following:

    1. When the user clicks a link, an alert/ popup comes up with a disclaimer.

    2. The user can either click OK to proceed, or cancel and not proceed.

    3. At the end of this disclaimer, it is going to say something like "click here to go to section C", with the link to section C (so I guess this rules out using an alert).

    4. If the user clicks Ok to proceed, he will be taken to another page of the site, but in a separate browser window.

    I keep getting almost there than something goes wrong - like I have everything else working but can't get a link in the alert, or I have everything else working but I can't get the new page to open in a separate window.

    I know this is a lot to ask of one script, but is it possible? Any resources you'd recommend?

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Beginning of JavaScript -
    function mymsgbox() {
    confirmed = window.confirm("Click OK to continue. Click Cancel to stop.");
    if (confirmed) {
        window.open('url to open','window name','attribute1,attribute2')
    } else {
        window.alert("You clicked Cancel");
    }
    }
    // - End of JavaScript - -->
    </SCRIPT>
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.


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
  •