I have this script for a popup javascript called modalbox, and the popup is only meant to popup once per day :
Quote:
<head><link rel="stylesheet" href="http://customizepsp.co.uk/forums/popup/modalbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://customizepsp.co.uk/forums/popup/prototype.js"></script>
<script type="text/javascript" src="http://customizepsp.co.uk/forums/popup/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="http://customizepsp.co.uk/forums/popup/modalbox.js"></script>
<script type="text/javascript">
var exp = 1;
function newCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString(); }
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/"; }
function readCookie(name) {
var nameSG = name + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); }
return null; }
function Modalbox.show() {
var num = readCookie('sancookie1')
if (num < 1) {
newCookie('sancookie1','testcookie1', exp);
SW=window.open('window.html','NewWin','toolbar=no, status=no,width=350,height=135,scrollbars')
SW.moveTo(190,240); }
}
</script></head>
<body onLoad="Modalbox.show('<form action=\'http://www.gamesites200.com/psp/in.php?id=1850\' method=\'post\' target=\'_blank\' \><img src=\'http://customizepsp.co.uk/forums/popup/vote.png\' width=\'500\' height=\'72\'><table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'5\'><tr><td align=\'center\' valign=\'top\'><strong>Please reward our efforts by voting for us. </strong><br> All votes are greatly appreciated. <br><br><br> <br></td></tr><tr><td align=\'right\' valign=\'bottom\'><input type=\'submit\' value=\'Yes, I want to vote!\' onclick=\'Modalbox.hide()\' /> <input type=\'button\' value=\'No..\' onclick=\'Modalbox.hide()\' /></td></tr></table></form>', {title: this.title,width: 500});">
|
But, the popup still pops up every time the page is viewed. You can see the popup here, its not a typical popup:
http://customizepsp.co.uk/forums/index.php?styleid=1
BUT....If I change whats in red and bold to "amt" instead of "Modalbox.show" an actual popup box appears with an error in it, but only once! So Im halfway there. I just need to know why it doesnt work with "body onLoad="
Modalbox.show('.." that I have :S
Thanks
EDIT: Ok I think I have fixed this now. If you go here
http://customizepsp.co.uk/forums/ and see the popup, then it doesnt appear again when ou refresh the page, then its worked! So does it work for you?