如何在JavaScript中设置命名cookie?
要在JavaScript中设置命名cookie,请运行以下代码。它在输入cookie中设置客户名称。
例
<html>
<head>
<script>
<!--
function WriteCookie() {
if( document.myform.customer.value == "" ) {
alert("Enter some value!");
return;
}
cookievalue= escape(document.myform.customer.value) + ";";
document.cookie="name=" + cookievalue;
document.write ("Setting Cookies : " + "name=" + cookievalue );
}
//-->
</script>
</head>
<body>
<form name="myform" action="">
Enter name: <input type="text" name="customer"/>
<input type="button" value="Set Cookie" onclick="WriteCookie();"/>
</form>
</body>
</html>热门推荐
3 会仙桥祝福语简短
10 与女儿分别祝福语简短
11 跨年祝福语简短有深意
12 孩子妈妈的祝福语简短
13 祖国祝福语简短网名
14 谢谢朋友的祝福语简短
15 高一祝福语简短 励志
16 钢琴人祝福语孩子简短
17 新年祝福语老公的简短
18 虎年拜年祝福语小孩简短