"其它两页set"?
没明白。你最好说的详细点,如果帖下关键代码最好。
没明白。你最好说的详细点,如果帖下关键代码最好。
解决方案 »
- 在FirFox下无法删除Cookies
- javascript小问题
- jquery ui问题,急求~~~
- 怎样才能让表单里所有名字为aaa的文本框格式化显示月和日
- 一个数据库和下拉菜单选择的问题,解决加分!
- 有点难度,cookie里存的是父页面的句柄,但是取出来的时候却不能用了?
- js表格提交问题
- 怎样捕获404错误并加载预定页面?
- 为什么{a:1,b:3}.a计算会报错,而[1,2,3][0]不会
- js 或者jquery mobile的回调函数 如何实现
- 这里有用过net1.1的treeview控件的朋友吗?请帮忙看看这个遍历函数为什么不好用?
- 大家帮我看看这段代码是不是有错误??总是提示说语法错误,,,
function SetCookie(sName, sValue)
{
date = new Date(2008,1,1);
document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();
}
</SCRIPT><select onchange="SetCookie('a',this.value)">
其它页面
<SCRIPT>
window.onload = function()
{
if(GetCookie("a") == "off")
{
document.formName.buttonName.disabled=true
}
else
{
document.formName.buttonName.disabled=false
}
}function GetCookie(sName)
{
// cookies are separated by semicolons
var aCookie = document.cookie.split("; ");
for (var i=0; i < aCookie.length; i++)
{
// a name/value pair (a crumb) is separated by an equal sign
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
} // a cookie with the requested name does not exist
return null;
}
</SCRIPT>
a.htm
===============
<SCRIPT>
function SetCookie(sName, sValue)
{
date = new Date(2008,1,1);
document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();
}
</SCRIPT><select onchange="SetCookie('a',this.value)">
<option value="on">on
<option value="off">off
</select>
<a href="b.htm">next</a>
b.htm
=================<form name=formName>
<input type=submit name="buttonName" value="提交">
</form>
<SCRIPT>
window.onload = function()
{
if(GetCookie("a") == "off")
{
document.formName.buttonName.disabled=true
}
else
{
document.formName.buttonName.disabled=false
}
}function GetCookie(sName)
{
// cookies are separated by semicolons
var aCookie = document.cookie.split("; ");
for (var i=0; i < aCookie.length; i++)
{
// a name/value pair (a crumb) is separated by an equal sign
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
} // a cookie with the requested name does not exist
return null;
}
</SCRIPT>