SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2003
    Location
    texas
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exit window problem

    Here is my current script. I need something I can put inside internal hyperlinks in the HTML to prevent the pop up from coming up except on exit.

    BETWEEN <HEAD> TAGS
    <script language='JavaScript'>
    <!-- hide from old browsers

    function openindex() {
    window.open("http://website.com/exit.htm","","location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=490,height=265");

    }

    // Stop hiding here -->
    </script>

    INSIDE <BODY> TAG
    onunLoad="openindex()">

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, first of all, I don't recommend this for three reasons

    1) It's annoying
    2) Popup blockers will kill this in an instant
    3) It's annoying

    That being said, here's an option for you
    Code:
    <script type="text/javascript">
     
    	var internalLink = false;
    	function exit()
    	{
    		if ( !internalLink )
    		{
    			window.open( "exit.htm", "", "width=500,height=300" );
    		}
    	}
     
    </script>
    Code:
    <body onunload="exit()">
     
    <a href="somepage.htm" onclick="internalLink=true;">Link</a>
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •