CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15
  1. #1

    POPUP lightbox onload

    I am looking for a way to have a thickbox or lightbox open on page load once per session where a person agrees to enter at own risk. and if they want to leave i direct them to google.

    Anyone know of how i can do this?

    Basically just a div that loads into the box if possible?

    I have this but it shows every page load.

    Code:
    
    
    
    <!-- Duly served from memcache (0.101513147354) --><div class="TB_overlayBG" id="TB_overlay"></div><div style="margin-left: -195px; width: 390px; margin-top: -200px; display: block;" id="TB_window"><div id="TB_ajaxContent" class="TB_modal" style="width: 360px; height: 355px;"><style type="text/css" media="screen">
    
    .exit   {
    font-weight:bold;
    font-size: 28px;
    
    }
    
    .exit a {
    color: #666;
    margin-right: 8px;
    margin-left: 8px;
    }
    
    .enter   {
    font-weight:bold;
    font-size: 28px;
    
    }
    
    .enter a {
    color: #009900;
    font-weight:bolder;
    
    
    }
    
    .help_title_disc {
      font-size:30px;
      color: #3F8EFF;
      font-weight: bold;
    
    
    }
    
    .enterexit   {
    font-size: 18px;
    text-align:left;
    margin-top:20px;
    
    margin-right:0px;
    
    }
    </style>
    
    <div style="padding: 6px;">
    <div class="help_title_disc" style="line-height: 100&#37;; margin-bottom: 20px;">
    This website contains explicit adult material.
    </div>
    
    <div style="font-size: 14px; line-height: 120%;">
    
    By entering this site I am agreeing with the following statements:<br>
    <br> - I am familiar with all local laws in my area that pertain to my right to view adult-oriented materials. <br>
    - I am at least 18 years of age, and may view adult materials without violating the legal standards of my community.
    </div>
    <div class="enterexit">
    <span class="enter"><a style="color: rgb(0, 153, 0);" href="#" onclick="$('#disc_fla').css('display','inline');tb_remove();document.cookie = 'disclaimer=true; expires=Thu, 2 Aug 2010 20:00:00 UTC; path=/';return false;" title="I agree">Enter</a></span>
    <span class="exit"><a style="color: rgb(204, 204, 204);" href="http://www.wikipedia.org/" id="leave">Leave</a></span>
    
    
    <p style="font-size: 14px;">
    
    
    Cookies must be <a target="_blank" href="http://www.google.com/support/accounts/bin/answer.py?answer=61416&amp;hl=en&amp;ctx=ch_ServiceLoginAuth&amp;p=mail" title="click here if you don't know how to enable cookies">enabled</a>
    
    </p>
    
    </div></div>
    
    
    
    
    </div>
    and this is in my head
    Code:
    <script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
    Basically i pulled that out of some source code of a site that has what i want.
    its an adult site so i dont want to put it on here. Unless i can link it???




    here is a link to my site so you can see what im trying to do
    http://thesocialcell.com


    Any help is much appreciated
    Last edited by davidjmorin; June 14th, 2010 at 04:33 PM.
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    Why don't you just pop a JavaScript alert with an Okay Cancel button? It would be so much easier.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: POPUP lightbox onload

    What i like about the lightbox/TB is that it produces an overlay of the main page.

    Is that possible in the method you suggested?



    Oh and that code i used above is just ugly coding not mine of course
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  4. #4

    Re: POPUP lightbox onload

    oh i want to mention that i would like to have it as a per session popup as well
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  5. #5

    Re: POPUP lightbox onload

    peej:

    How about a way to pop a link open automatically using lightbox and js?

    If you go to that page now you will see a link on the left and when clicked it opens LB. i want that to open automatically
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    There are both positives and negatives to using JavaScript's confirm(). Using lightbox frameworks will require some editing since they can easily be dismissed by just clicking around them. So, you would have to write your own, or modify previously existing ones. This could take some time.

    If you use Javascript's confirm(), then you will lose some extra graphical possibilites, but you will easily be able to ask the user if he/she is 18 or older. This shows modally, so you cannot just dismiss it without answering.

    To solve the "once per session" issue is by using a cookie.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7

    Re: POPUP lightbox onload

    Quote Originally Posted by PeejAvery View Post
    There are both positives and negatives to using JavaScript's confirm(). Using lightbox frameworks will require some editing since they can easily be dismissed by just clicking around them. So, you would have to write your own, or modify previously existing ones. This could take some time.

    If you use Javascript's confirm(), then you will lose some extra graphical possibilites, but you will easily be able to ask the user if he/she is 18 or older. This shows modally, so you cannot just dismiss it without answering.

    To solve the "once per session" issue is by using a cookie.

    Hmmmm i guess i have some more digging. What i really am looking for is not age verification but a pop up that has links in it
    Just so happens that the look i like was on an adult site (referenced in another forum )
    one for members---------login page
    and one to registe----->goes to registration page
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  8. #8
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    In that case, you won't be able to use confirm().
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  9. #9

    Re: POPUP lightbox onload

    Quote Originally Posted by PeejAvery View Post
    In that case, you won't be able to use confirm().
    any recommendations
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  10. #10

    Re: POPUP lightbox onload

    ok so i have the following code working but how in the heck do i get it to load on page load per user session?

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     
    <head>
     
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="thickbox.js"></script>
    
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />
     
    </head>
     
    <body>
    
    <a href="ajaxOverFlow.html?height=300&width=300" title="add a caption to title attribute / or leave blank" class="thickbox">Scrolling content</a>  
    <a href="ajax.PHP?height=220&width=400" class="thickbox" title="add a caption to title attribute / or leave blank">No-scroll content</a>  
    <a href="ajaxLogin.html?height=85&width=250&modal=true" class="thickbox" title="Please Sign In">login (modal)</a>  
    <a href="ajaxTBcontent.html?height=200&width=300" class="thickbox" title="">Update ThickBox content</a>
     
    </body>
     
    </html>
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  11. #11
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    Use a cookie with 0 lifetime. Check to see if the cookie exists...if it doesn't show the lightbox and create the cookie.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  12. #12

    Re: POPUP lightbox onload

    Quote Originally Posted by PeejAvery View Post
    Use a cookie with 0 lifetime. Check to see if the cookie exists...if it doesn't show the lightbox and create the cookie.
    Ok so i found exactly what im looking for

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head>
    
    
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
    
    
    
    <link rel="meta" href="http://fantasti.cc/labels.rdf" type="application/rdf+xml" title="ICRA labels">
    
    <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="http://knapsack.fantasti.cc/templates/site/ie.css" > <![endif]-->
    <link rel="stylesheet" href="rtainment_files/fantasticc_styles.css" type="text/css" media="screen">
    
    <script type="text/javascript" src="rtainment_files/jquery.js"></script>
    <script type="text/javascript" src="rtainment_files/jquery-ui.js"></script>
    <script type="text/javascript" src="rtainment_files/thesocialcell.js"></script>
    </head>
    
    <body>
    
    <div class="TB_overlayBG" id="TB_overlay"></div>
    
          <div style="margin-left: -195px; width: 390px; margin-top: -200px; display: block;" id="TB_window">
                                   <div id="TB_ajaxContent" class="TB_modal" style="width: 360px; height: 355px;">
    
    
    
    
    
    
    <div style="padding: 6px;">
    <div class="help_title_disc" style="line-height: 100%; margin-bottom: 20px;">
    This website needs members to be registered
    </div>
    
    <div style="font-size: 14px; line-height: 120%;">
    
    By entering this site I am agreeing with the following statements:<br>
    I am a member
    </div>
    <div class="enterexit">
    <span class="enter"><a style="color: rgb(0, 153, 0);" href="#" onclick="$('#disc_fla').css('display','inline');tb_remove();document.cookie = 'disclaimer=true; expires=Thu, 2 Aug 2010 20:00:00 UTC; path=/';return false;" title="I agree">Enter</a></span>
    <span class="exit"><a style="color: rgb(204, 204, 204);" href="http://www.wikipedia.org/" id="leave">Leave</a></span>
    
    
    <p style="font-size: 14px;">
    
    
    Cookies must be <a target="_blank" href="http://www.google.com/support/accounts/bin/answer.py?answer=61416&amp;hl=en&amp;ctx=ch_ServiceLoginAuth&amp;p=mail" title="click here if you don't know how to enable cookies">enabled</a>
    
    </p>
    
    </div></div>
    
    
    
    
    </div></div><div style="position: absolute; display: none;" id="jHelperTipContainer"></div><div style="display: none;" id="reportx"></div><div style="position: absolute; display: none;" id="jHelperTipAttrContainer"></div><div style="display: none;" id="helpx"></div>
    
    
    
    </body></html>


    But cookies are not working. i want it to only show per session

    grrrrrrrrrrrrrrrr

    Peej thanks for the help BTW.

    I attached files
    Attached Files Attached Files
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  13. #13
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    Quote Originally Posted by davidjmorin View Post
    But cookies are not working.
    That's because you aren't doing what I mentioned in the previous post.

    Code:
    <script type="text/javascript">
      if (document.cookie.indexOf("lightbox=") == -1) {
        var now = new Date();
        document.cookie = "lightbox=yes";
    
        // code to show the lightbox here
      }
    </script>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  14. #14

    Re: POPUP lightbox onload

    ? like so?

    I do not work with js much and have been out of programming for a long time sorry if i sound stupid peej

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head>
    
    
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
    
    
    
    <link rel="meta" href="http://fantasti.cc/labels.rdf" type="application/rdf+xml" title="ICRA labels">
    
    <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="http://knapsack.fantasti.cc/templates/site/ie.css" > <![endif]-->
    <link rel="stylesheet" href="rtainment_files/fantasticc_styles.css" type="text/css" media="screen">
    
    <script type="text/javascript" src="rtainment_files/jquery.js"></script>
    <script type="text/javascript" src="rtainment_files/jquery-ui.js"></script>
    <script type="text/javascript" src="rtainment_files/fantasticc.js"></script>
    
    <script type="text/javascript">
      if (document.cookie.indexOf("lightbox=") == -1) {
        var now = new Date();
        document.cookie = "lightbox=yes";
    
        // code to show the lightbox here
      }
    </script>
    
    
    </head>
    
    <body>
    
    <div class="TB_overlayBG" id="TB_overlay"></div>
    
          <div style="margin-left: -195px; width: 390px; margin-top: -200px; display: block;" id="TB_window">
                                   <div id="TB_ajaxContent" class="TB_modal" style="width: 360px; height: 355px;">
    
    
    
    
    
    
    <div style="padding: 6px;">
    <div class="help_title_disc" style="line-height: 100&#37;; margin-bottom: 20px;">
    This website needs members to be registered
    </div>
    
    <div style="font-size: 14px; line-height: 120%;">
    
    By entering this site I am agreeing with the following statements:<br>
    I am a member
    </div>
    <div class="enterexit">
    <span class="enter"><a style="color: rgb(0, 153, 0);" href="#" onclick="$('#disc_fla').css('display','inline');tb_remove();document.cookie = 'disclaimer=true; expires=0; path=/';return false;" title="I agree">Enter</a></span>
    <span class="exit"><a style="color: rgb(204, 204, 204);" href="register.php" id="leave">Register</a></span>
    
    
    <p style="font-size: 14px;">
    
    
    Cookies must be <a target="_blank" href="http://www.google.com/support/accounts/bin/answer.py?answer=61416&amp;hl=en&amp;ctx=ch_ServiceLoginAuth&amp;p=mail" title="click here if you don't know how to enable cookies">enabled</a>
    
    </p>
    
    </div></div>
    
    
    
    
    </div></div><div style="position: absolute; display: none;" id="jHelperTipContainer"></div><div style="display: none;" id="reportx"></div><div style="position: absolute; display: none;" id="jHelperTipAttrContainer"></div><div style="display: none;" id="helpx"></div>
    
    
    
    </body></html>

    I have it live here http://thesocialcell.com/codeguru.htm
    Last edited by davidjmorin; June 15th, 2010 at 12:15 PM.
    New to PHP and MySql. Started looking at scripts about a week ago. So far have very little understanding of it. So please be easy with me if I ask a stupid question.

    www.ethans-space.com

  15. #15
    Join Date
    May 2002
    Posts
    10,943

    Re: POPUP lightbox onload

    See my code comment about showing the lightbox? That's where you ned to put the code that triggers the showing of the lightbox.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured