<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function set_scrbar_color() {
color_val = prompt("スクロールバーに好きな色を設定して下さい。");
SetCookie ('color_val', color_val, this_day);
chg_scrbar_color(color_val);
}
function chg_scrbar_color(bar_clr) {
if (document.all) {
document.body.style.scrollbarBaseColor = bar_clr;
}
}
var day_span = 90;
var this_day = new Date();
this_day.setTime(this_day.getTime() + (day_span*24*60*60*1000));
function read_colval(){
var color_val = GetCookie('color_val')
if (color_val == null) {
color_val = prompt("好きな色をどうぞ!");
SetCookie ('color_val', color_val, this_day);
}
chg_scrbar_color(color_val);
return color_val;
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString()));
}
//-->
</SCRIPT>
<BODY onLoad=read_colval()>
<CENTER>
<form>
<input type=button value=スクロールバーの色を変える。 onClick=set_scrbar_color()>
</form>
</CENTER>
</BODY>
</HTML>
|