在 JavaScript 中读取 cookie
在文本框 onchange 属性上我调用了一个 javascript 函数 我已经写了这个,
function testbox1()
{
var strline1side1 = document.frmartwork.side1textbox1.value;
document.cookie="lineside1="+strline1side1.replace(" "," ")+";path=/;";
}
我想在页面重新加载时分配这个“lineside1”cookie值
window.onload=function()
{
document.frmartwork.side1textbox1.value = "here i want that cookie "
}
我该怎么做?
On textbox onchange property i have called one javascript function
In that I have written this,
function testbox1()
{
var strline1side1 = document.frmartwork.side1textbox1.value;
document.cookie="lineside1="+strline1side1.replace(" "," ")+";path=/;";
}
I want to assign this "lineside1" cookie value when page is reload
window.onload=function()
{
document.frmartwork.side1textbox1.value = "here i want that cookie "
}
How can i do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用 jquery cookie 插件
You should use jquery cookie plugin
如果您使用 jQuery - 使用 jQuery.cookies 插件。使用起来非常简单。
另外,如果你开始使用 jQuery - 使用它:)
If you are using jQuery - use jQuery.cookies plugin. It's quiet simple to use.
Also, if you start using jQuery - use it :)