开发者

how to append the cookies values

I have four cookie values like $.cookie('line1side1',{ path:'/'}) and $.cookie('line2side1',{ path:'/'})

I want to append this all values and assign it to the one text-box.

document.getElementsByName('Custom_Field_Custom7')[0].value= all values of 开发者_如何学Ccookie

How should I write?


This uses jQuery (I'm assuming you're using it since you reference $.cookie). Basically you can grab the current cookie collection, split it into the cookies and map the values into an array. Then just join the array and dump it into your textbox.

alert($.map(document.cookie.split(";"), function(c){ return c.split("=")[0];  }).join(", "));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜