Non-Persistent Cookie

[Total: 0    Average: 0/5]

This uses cookies to get input from the user 1 time per users web session.

Head Code:

<SCRIPT type="text/javascript" src="http://www.js-examples.com/bin/cookies.js"></SCRIPT>

Body Code:

<SCRIPT type="text/javascript">
 var myCookie = new Cookie(document,"myName",0);
 if (!myCookie.read() || !myCookie.good) { 
 myCookie.good=prompt("A word for something great:","") 
 } 
 myCookie.write() 
 var _good = myCookie.good?myCookie.good:' ' 
 function changeText() {
 myCookie.good=prompt("A word for something great:","");
 myCookie.write()
 } 
 document.write("<body bgcolor=white>I'm "); 
 document.write(_good); 
 document.write("!</body>"); 
</SCRIPT>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *