<script language="JavaScript">
function start1(){
var cookie = " " + document.cookie;
var search = " " + "color" + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
//alert(setStr);
changeBG(setStr);
}
var backColor = new Array();
backColor[0] = '#FF0000'; //red
backColor[1] = '#00FF00'; //green
backColor[2] = '#0000FF'; //blue
backColor[3] = 'grey'; //grey
function changeBG(whichColor){
document.bgColor = backColor[whichColor];
document.cookie = "color=" + whichColor;
//alert (document.cookie);
}
</script>
<body onload="start1()">
<a href="javascript:changeBG(0)">Red</a><br>
<a href="javascript:changeBG(1)">Green</a><br>
<a href="javascript:changeBG(2)">Blue</a><br>
<a href="javascript:changeBG(3)">Grey</a><br>
<a href="color2.htm">go</a>
вроде бы сделал. приму критику