只要它的值是false,就說明瀏覽器不支持 JavaScript。注意其初始值是 false。我們的 JavaScript 函數(shù)將把這個值換為true。在 BODY 中這樣寫:
<body onload="cc()">;
cc()的內(nèi)容如下:
<script language="JavaScript">;
<!-
function cc()
{
/* check for a cookie */
if (document.cookie == ""
{
/* if a cookie is not found - alert user -
change cookieexists field value to false */
alert("COOKIES need to be enabled!"
/* If the user has Cookies disabled an alert will let him know
that cookies need to be enabled to log on.*/
document.Form1.cookieexists.value ="false"
} else {
/* this sets the value to true and nothing else will happen,
the user will be able to log on*/
document.Form1.cookieexists.value ="true"
}
}
/* Set a cookie to be sure that one exists.
Note that this is outside the function*/
document.cookie = 'killme' + escape('nothing')
// -->;
</script>;