View Single Post
Old 09-14-2010, 07:19 AM   PM User | #1
EGS
New Coder

 
Join Date: Feb 2008
Location: New Jersey
Posts: 61
Thanks: 11
Thanked 0 Times in 0 Posts
EGS can only hope to improve
Question Help? Show JavaScript Once Per Day Only?

Help. How do I show the below JavaScript code to each unique visitor only once per day or any amount of days I want to set?

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<
html>
<
head>
    <
title>Untitled</title>
</
head>

<
body>

<!-- 
this goes anywhere in the root of the -->
<
div id="slideIn" style="position:absolute; width: 720px; height: 320px; left: 0; top: -600px; z-index: 100; border: 1px solid gray; padding: 20px; font-family: 14px Verdana, sans-serif, Tahoma, Arial; font-color: black;"
    
<div style="text-align:right"><input type="button" value="CLOSE" onclick="f_slideOut()" style="background: black; color: white; border: 2px solid #dcdcdc;"></div>
This is where the content goes blah blah
Blah Blah
Blah Blah

Please help 
:(
</
div>
<
div id="slideInShade" style="position:absolute;z-index:99;visibility:hidden;"></div>
<
script>
var 
s_userAgent navigator.userAgent.toLowerCase(),
    
s_location String(window.location).toLowerCase(); // copyright protection

var b_mac s_userAgent.indexOf('mac') != -1,
    
b_ie5    s_userAgent.indexOf('msie 5') != -1,
    
b_ie6    s_userAgent.indexOf('msie 6') != -&& s_userAgent.indexOf('opera') == -1,
    
b_ieMac  b_mac && b_ie5,
    
b_safari b_mac && s_userAgent.indexOf('safari') != -1,
    
b_opera6 s_userAgent.indexOf('opera 6') != -1;

var 
e_slideIn document.getElementById('slideIn');
var 
e_slideInShade document.getElementById('slideInShade');

function 
f_slideIn() {
    if (!
window.e_slideIn) return;
    var 
n_width  e_slideIn.offsetWidth;
    var 
n_height e_slideIn.offsetHeight;
    var 
n_left   = (f_clientWidth() - n_width) / 2;
    var 
n_top    parseInt(e_slideIn.style.top);
    var 
n_moveTo = (f_clientHeight() - n_height) / 2;

    
e_slideIn.style.left n_left 'px';
    
e_slideIn.style.visibility 'visible';
    
f_customShade(n_widthn_heightn_leftn_top);
    
e_slideInShade.style.visibility 'visible';

    
n_slideMove (n_topn_moveTo);
}

function 
n_slideMove (n_topn_moveTo) {
    
n_inc Math.round((n_moveTo n_top) / 20);
    if (!
n_inc) return;
    
n_top += n_inc;
    
f_customShade(nullnullnulln_top);
    
e_slideIn.style.top  n_top 'px';
    
setTimeout('n_slideMove(' n_top ',' n_moveTo ')'10);
}

function 
f_slideOut() {
    if (!
window.e_slideIn) return;
    
e_slideIn.style.visibility 'hidden';
    
e_slideInShade.style.visibility 'hidden';
}

function 
f_clientWidth() {
    if (
typeof(window.innerWidth) == 'number')
        return 
window.innerWidth;
    if (
document.documentElement && document.documentElement.clientWidth)
        return 
document.documentElement.clientWidth;
    if (
document.body && document.body.clientWidth)
        return 
document.body.clientWidth;
    return 
null;
}
function 
f_clientHeight() {
    if (
typeof(window.innerHeight) == 'number')
        return 
window.innerHeight;
    if (
document.documentElement && document.documentElement.clientHeight)
        return 
document.documentElement.clientHeight;
    if (
document.body && document.body.clientHeight)
        return 
document.body.clientHeight;
    return 
null;
}
function 
f_customShade (n_widthn_heightn_leftn_top) {
    if (!
e_slideInShade) return;
    if (
n_width != nulle_slideInShade.style.width = (n_width 8) + 'px';
    if (
n_left != nulle_slideInShade.style.left = (n_left 1) + 'px';
    
e_slideInShade.style.top = (n_top 1) + 'px';
    if (!
e_slideInShade.innerHTML) {
        if (
b_ie5 || b_ie6)
            
e_slideInShade.innerHTML '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td rowspan="2" colspan="2" width="6"><img src="images/pixel.gif"></td><td width="7" height="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/shade_tr.png\', sizingMethod=\'scale\');"><img src="images/pixel.gif"></td></tr><tr><td height="' + (n_height 7) + '" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/shade_mr.png\', sizingMethod=\'scale\');"><img src="images/pixel.gif"></td></tr><tr><td width="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/shade_bl.png\', sizingMethod=\'scale\');"><img src="images/pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/shade_bm.png\', sizingMethod=\'scale\');" height="7" align="left"><img src="images/pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/shade_br.png\', sizingMethod=\'scale\');"><img src="images/pixel.gif"></td></tr></table>';
        else
            
e_slideInShade.innerHTML '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td rowspan="2" width="6"><img src="images/pixel.gif"></td><td rowspan="2"><img src="images/pixel.gif"></td><td width="7" height="7"><img src="images/shade_tr.png"></td></tr><tr><td background="images/shade_mr.png" height="' + (n_height 7) + '"><img src="images/pixel.gif"></td></tr><tr><td><img src="images/shade_bl.png"></td><td background="images/shade_bm.png" height="7" align="left"><img src="images/pixel.gif"></td><td><img src="images/shade_br.png"></td></tr></table>';
    }
}
f_slideIn();
</script>

</body>
</html> 
__________________
Online Game Services - Game King
EGS is offline   Reply With Quote