PDA

View Full Version : 3D spinning message



SilverWolf
02-22-2008, 06:37 PM
1) Script Title: 3D spinning message


2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex10/circlemsg.htm

3) Describe problem: How can I make the spinning message load only once upon entering my site.

Right now if you click the return to "Home" link it loads, or if you have to refresh a page it loads, or if I am up dating a page it loads.

I would really appriecate some help please and thank you.

SilverWolf

jscheuer1
02-22-2008, 06:52 PM
You would need a cookie for that. Near the end of the script, where it has:


if (window.attachEvent) //DD added code
window.attachEvent("onload", changeform) //DD added code
else
window.onload=changeform

Make it like so:


if(!readCookie('spinner')){
if (window.attachEvent) //DD added code
window.attachEvent("onload", changeform) //DD added code
else
window.onload=changeform
}
createCookie('spinner');

And add this cookie code from quirksmode.org just before the </script> tag:


function createCookie(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 nameEQ = 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(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}

SilverWolf
02-23-2008, 12:50 AM
Oh so cool it worked thank you so much :)