javascript实现cookies的查询代码实例
javascript实现cookies的查询代码实例
<script language="javascript">
<!--
var cookies = document.cookie;
function readcookie(name) {
var start = cookies.<a href="http://www.3ppt.com/tags.php/indexof">indexof</a>(name + "=");
if (start == -1){
alert("cookie not found");
}
start = cookies.indexof("=", start) + 1;
var end = cookies.indexof(";", start);
if (end == -1){
end = cookies.length;
}
var value = unescape(cookies.substring(start, end));
if(value == null){
alert("no cookie found");
} else{
alert("cookie value is: " + value);
}
}
readcookie("www.3ppt.com");
-->
</script>