Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-30-2008, 11:19 PM   #1
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
DTML pop up help? Sessions cookies - I'm frustrated!

Sorry, my last thread wasn't named properly enough to target the right help

I have a site and I want to display a div layer on it, but only ONCE per session..
as to not annoy surfers.

So basically they come on to the site, see the DIV pop up, click it or click close, and if they click close it sets a cookie, so it's not shown again

I'm pulling my fucking hair out here.

I tried modifying the code I found here, http://cssbeauty.com/skillshare/disc...using-cookies/

but the layer pops up, then disappears..

Any help in the right direction would be appreciated
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2008, 11:23 PM   #2
Malicious Biz
So Fucking Banned
 
Join Date: Mar 2005
Location: Put Shoe On Head Plz
Posts: 4,575
iMind is a communist
Malicious Biz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 12:32 AM   #3
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
bump
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 12:51 AM   #4
qwe
Confirmed User
 
Join Date: Jul 2003
Posts: 2,109
it has to be that mac you own
qwe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 12:56 AM   #5
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
Quote:
Originally Posted by qwe View Post
it has to be that mac you own
yeah, that must be it.

retard.
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 12:56 AM   #6
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
why not just start the session when you load the div, not when they click close..just an idea.

didnt look at the code, but maybe the onclose isnt working right or something.
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 12:59 AM   #7
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
Thanks for the suggestions Alky..

Sadly my knowledge of code ends at HTML, so I'm havin a hard time doing anything with that script, was hoping there was a simple solution but doesn't seem to be
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 01:03 AM   #8
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by iMind View Post
Thanks for the suggestions Alky..

Sadly my knowledge of code ends at HTML, so I'm havin a hard time doing anything with that script, was hoping there was a simple solution but doesn't seem to be
PHP Code:
session_start();
if(!
$_SESSIONS["ldhtml"]) {
$_SESSIONS["ldhtml"]="1";
//LOAD DHTML

something like that should work
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 01:10 AM   #9
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
hmm, perhaps it's time I take a PHP course..

Currently I'm using this

PHP Code:
<script language="javascript" type="text/javascript">
  <!--
   function 
getCookie(name){
    if(
document.cookie!=""){
      var 
cookie=document.cookie;
      var 
start=cookie.indexOf(name);
      var 
stop;

      if(
start!=-1){
        
start+=name.length+1;
        
stop=cookie.indexOf(';'start);

        if(
stop==-1)
          
stop=cookie.length;
        return 
unescape(cookie.substring(startstop));
      }
    }
    else
      return 
false;
  }

  function 
makeCookie(namevalue){
    var 
cookie name '=' escape(value) + ';';
    
document.cookie cookie;
  }

  function 
showhide(idsetcookie){
    if(
setcookie==true){
      var 
cookie=getCookie('show');
      var 
show=new Array();
      if(
cookie) {show=cookie.split(', ');}
      var 
invar=-1;

    for(
i=0show.lengthi++)
      if(
show[i]==id)
        
invar=i;
    }

    if(
document.getElementById(id).style.display=="none"){
      
document.getElementById(id).style.display="block";

      if(
invar==-&& setcookie==true)
        
show[show.length]=id;
    }
    else{
      
document.getElementById(id).style.display="none";

      if(
invar!=-&& setcookie==true)
        
show.splice(invar1);
    }

    if(
setcookie==true)
      
makeCookie('hide'show.join(', '));
  }

  function 
init(){
    
showhide('container'false)

    var 
cookievalue=getCookie('show');
    var 
show;

    if(
cookievalue!=""){
      
show=cookievalue.split(', ');

      for(
i=0show.lengthi++)
        
document.getElementById(show[i]).style.display="block";
    }
  }
  -->
  
</script> 
and then

PHP Code:
      <a href="javascript:showhide('container', false)">Close This Window!</a

It closes alright, but if I refresh the page it shows again
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 01:17 AM   #10
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
where are you calling init from?
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 01:38 AM   #11
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
Quote:
Originally Posted by Alky View Post
where are you calling init from?
from the body tag
onload=init()
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2008, 01:41 AM   #12
iMind
Confirmed User
 
Join Date: Nov 2007
Posts: 937
it's working .. but flashes real quick, which obviously is unsuitable
iMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.