...

View Full Version : Javascript fadeout + Remember user input



Html33
10-02-2008, 07:35 PM
Hello, Thanks for reading this and i hope you can help me today :)

Right, I have a forum [Dhgaming.com] And have many affiliate sites which require the user to vote for the particular affiliate to put the sites rank up. This will ofcorse help people looking for our web site on the affiliates site. But to the point.

I would like it so that when the index page is loaded the screen is grayed out something like this

http://codingatlas.wordpress.com/2006/07/08/darken-the-page-and-set-focus-on-the-user-input/

But i don't want to anoy the hell out of my users, and would like to make the script so that it only appears once every 25 hours. I'm assuming this would be needed to be done with Cookies but i don't have a clue how.

If someone is willing to help me, or even make a script for me. It would be really apricated.

Thanks : )

vwphillips
10-03-2008, 09:20 AM
I'm assuming you only want the cookie code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function zxcCreateCookie(zxcnme,zxcv,zxcdays){
document.cookie=zxcnme+'='+zxcv+';expires='+new Date(new Date().getTime()+zxcdays*86400000).toGMTString();+';path=/';
}

function zxcReadCookie(zxcnme){
zxcnme+='=';
var zxcsplit = document.cookie.split(';');
for(var zxc0=0;zxc0<zxcsplit.length;zxc0++) {
var zxcs=zxcsplit[zxc0];
while (zxcs.charAt(0)==' ') zxcs=zxcs.substring(1,zxcs.length);
if (zxcs.indexOf(zxcnme)==0) return zxcs.substring(zxcnme.length,zxcs.length);
}
return null;
}

function zxcRestore(zxcnme,zxchrs){
var zxctime=new Date().getTime();
var zxcv=zxcReadCookie(zxcnme);
if (!zxcv||zxctime/1000/60/60-zxcv/1000/60/60>zxchrs){
alert('call your function to show the panel');
zxcCreateCookie(zxcnme,zxctime,1);
}
}
/*]]>*/
</script></head>

<body onload="zxcRestore('zxcnme11',25)">
</form>

</body>

</html>

with a simple mask


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
body {
height:2000px;margin-Top:0px;margin-Left:0px;
}

.mask {
position:absolute;visibility:hidden;top:0px;left:0px;width:100%;text-Align:center;background-Color:red;
}

/*]]>*/
</style><script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function zxcCreateCookie(zxcnme,zxcv,zxcdays){
document.cookie=zxcnme+'='+zxcv+';expires='+new Date(new Date().getTime()+zxcdays*86400000).toGMTString();+';path=/';
}

function zxcReadCookie(zxcnme){
zxcnme+='=';
var zxcsplit = document.cookie.split(';');
for(var zxc0=0;zxc0<zxcsplit.length;zxc0++) {
var zxcs=zxcsplit[zxc0];
while (zxcs.charAt(0)==' ') zxcs=zxcs.substring(1,zxcs.length);
if (zxcs.indexOf(zxcnme)==0) return zxcs.substring(zxcnme.length,zxcs.length);
}
return null;
}

function zxcRestore(zxcnme,zxchrs,zxcid,zxcopc){
var zxctime=new Date().getTime();
var zxcv=zxcReadCookie(zxcnme);
if (!zxcv||zxctime/1000/60/60-zxcv/1000/60/60>zxchrs){
var zxcobj=document.getElementById(zxcid);
zxcOpacity(zxcobj,zxcopc);
zxcobj.style.height=document.body.scrollHeight+'px';
zxcobj.style.visibility='visible';
zxcCreateCookie(zxcnme,zxctime,1);
}
}

function zxcOpacity(zxcobj,zxcopc){
if (zxcopc<0||zxcopc>100) return;
zxcobj.style.filter='alpha(opacity='+zxcopc+')';
zxcobj.style.opacity=zxcobj.style.MozOpacity=zxcobj.style.KhtmlOpacity=zxcopc/100-.001;
}


/*]]>*/
</script></head>

<body onload="zxcRestore('zxcnme2',25,'tst',10)">
text

<div id="tst" class="mask" >
<input name="" />
</div>
<div style="height:2000px;" >for test page height</div>

</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum