I need a cookie-counter that stops a css animation after the first visit. How is this done, I've found this code that i think might be close to what I need. But I'm new to javascript. can any one please help :)

<![CDATA[ function startAnimation() { var cookie = document.cookie; if (cookie.indexOf('preventAnimation=true') === -1) { document.getElementById('elementToBeAnimated').setAttribute('class','animate'); } } function setPreventAnimationCookie() { document.cookie = 'preventAnimation=true; path=/'; } window.onload = startAnimation(); window.onbeforeunload = setPreventAnimationCookie(); ]]> <![CDATA[ function startAnimation() { var cookie = document.cookie; if (cookie.indexOf('preventAnimation=true') === -1) { document.getElementById('elementToBeAnimated').setAttribute('class','animate'); } } function setPreventAnimationCookie() { document.cookie = 'preventAnimation=true; path=/'; } window.onload = startAnimation(); window.onbeforeunload = setPreventAnimationCookie(); ]]>

283 0 0