Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Select(id,value,days){
if (value){
document.getElementById(id).style.backgroundColor=value;
document.cookie=id+'='+value+';expires='+(new Date(new Date().getTime()+days*86400000).toGMTString())+';path=/';
}
}
function cookie(nme){
var re=new RegExp(nme+'=[^;]+','i');
if (document.cookie.match(re)){
return document.getElementById(nme).style.backgroundColor=document.cookie.match(re)[0].split("=")[1];
}
}
/*]]>*/
</script>
</head>
<body onload="cookie('tst');">
<h1 id="tst" style="background-Color:red;" >
Some Text
</h1>
<select name="tom" size="1" onchange="Select('tst',this.value,1)">
<option value="">Select Color</option>
<option value="red">red</option>
<option value="green">green</option>
<option value="blue">blue</option>
</select>
</body>
</html>
Bookmarks