View Single Post
Old 12-01-2008, 01:10 AM  
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