SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Location
    13 miles off the French Coast
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi all. I can find plenty of popup window code examples but I want one which works the same way the sitepoint code does and pops up a window to ask if the user wants to subcsribe to our newsletter for the first time they visit and then does not reappear each time they visit, I assume tghis uses a cookie. Maybe Sitepoint could point me in the right direction.

    Thank you one and all

    Regards AndyD.

  2. #2
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a very simple popup window maker.

    This goes in the head of the document:
    Code:
    <script language="JavaScript" type="text/javascript">
    
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,location=1,statusbar=1,menubar=1,resizable=1,width=400,height=300');");
    }
    // End -->
    </script>
    You can set any of the variables to anything you like.

    Your links should look like this:
    Code:
    <A HREF="javascript:popUp('url_you_want_to_open')">Open the Popup Window</A>
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  3. #3
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And the little smiley face is a capitol "P"...lol
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cckrocks: you can go edit your post, and check a box just above the Submit button to Disable all smilie faces - that ought to fight the little guy with his tongue sticking out in the middle of your code.

    AndyD: Checkout these threads...

    - http://www.sitepointforums.com/showt...?threadid=7884
    - http://www.sitepointforums.com/showt...?threadid=5516

    Hope that helps!

  5. #5
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I know....thanks.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  6. #6
    SitePoint Enthusiast jrwap's Avatar
    Join Date
    Oct 2000
    Location
    NJ
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would I use this with PHP? I am trying to take url's out of a MySQL database with the name $url. How do I open this url up using the above script or any other?

    Thanks,

    -JRW

  7. #7
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just write the link dynamically in PHP, slotting in your PHP variable where the URL belongs:

    Code:
    <A HREF="javascript:popUp('<?=$url?>')">Open the Popup Window</A>
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •