分裂cookie [英] Splitting cookie
问题描述
任何人都可以帮助解决这个问题。我试图使用cookie中的数据动态绘制
图表。我已经编写了脚本来实际绘制
图表,为此我创建了两个数组,其中包含我需要的数据
预设。我想做的是分割存储数据的cookie,并从中创建两个数组。
用于创建cookie的函数是如下
:函数SetCookie(名称,值){
document.cookie = name +" =" + escape(value);
}
使用以下脚本调用:
< body onload =" SetCookie(''sales'',''pan1 = 23,pan3 = 153,pan4 = 2 1,pan9 = 5'')"
I希望通过分割cookie来创建以下数组:
array1 =(" sales"," pan1"," pan3"," pan4"," pan9" )
array2 =(23,153,21,5)
有人可以帮忙吗?非常感谢提前。
" Steve Darby" < RA **************** @ ntlworld.com>在留言中写道
新闻:cY ************** @ newsfe6-win.ntli.net ...任何人都可以帮忙有这个问题。我试图使用来自cookie的数据动态绘制图表。我已经编写了脚本实际上
绘制图形,为此我创建了两个数组,其中包含我需要的数据
预设。我想做的是分割存储数据的cookie,并从中创建两个数组。
用于创建cookie的函数如下
:function SetCookie(name,value){
document.cookie = name +" =" + escape(value);
}
使用以下脚本调用:
< body onload =" SetCookie(''sales'', ''pan1 = 23,pan3 = 153,pan4 = 2 1,pan9 = 5'')>
我希望通过拆分cookie来创建以下数组:
array1 =(" sales",pan1",pan3,pan4,pan9)
array2 =(23,153,21,5)
你的功能是什么&SetCookie()看起来像?
像这样:
函数SetCookie(名称,值){
文件.cookie = name +" =" + escape(value);
}
" Steve Darby" < RA **************** @ ntlworld.com>在消息中写道
新闻:在*************** @ newsfe6-win.ntli.net ...喜欢这个:
函数SetCookie(名称,值){
document.cookie = name +" =" + escape(value);
}
如果你这样做:
alert(unescape(document.cookie));
你知道吗?
sales = pan1 = 23,pan3 = 153,pan4 = 21,pan9 = 5
Can anyone help with this problem. I am attempting to dynamically draw a
graph using data from a cookie. I have written the script to actually draw
the graph, for which I hav created two arrays with the data I required
preset into them. What I wish to do is split the cookie in which the data
is stored and create two array from it.
The function used to create the cookie is as follows
:function SetCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
which is called with the following script:
<body onload="SetCookie(''sales'',''pan1=23,pan3=153,pan4=2 1,pan9=5'')">
I wish to create the following arrays by splitting the cookie:
array1=("sales","pan1","pan3","pan4","pan9")
array2=(23,153,21,5)
Can anyone help? Many thanks in advance.
解决方案"Steve Darby" <ra****************@ntlworld.com> wrote in message
news:cY**************@newsfe6-win.ntli.net...Can anyone help with this problem. I am attempting to dynamically draw a
graph using data from a cookie. I have written the script to actually draw the graph, for which I hav created two arrays with the data I required
preset into them. What I wish to do is split the cookie in which the data
is stored and create two array from it.
The function used to create the cookie is as follows
:function SetCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
which is called with the following script:
<body onload="SetCookie(''sales'',''pan1=23,pan3=153,pan4=2 1,pan9=5'')">
I wish to create the following arrays by splitting the cookie:
array1=("sales","pan1","pan3","pan4","pan9")
array2=(23,153,21,5)
Can anyone help? Many thanks in advance.
What does your function "SetCookie()" look like?
Like this:
function SetCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
"Steve Darby" <ra****************@ntlworld.com> wrote in message
news:In***************@newsfe6-win.ntli.net...Like this:
function SetCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
If you do:
alert(unescape(document.cookie));
do you get this?
sales=pan1=23,pan3=153,pan4=21,pan9=5
这篇关于分裂cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!