讀出 cookie 的值," " 變為 "+" , "(" 變為 "%28", ")" 變為 "%29"我怎樣解決這個問題!! <script>var s1 = "sdf (dsg)"alert(escape(s1));</script> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我在中寫入的值為"TERRAILLON (SPAIN SHIPMENT)"在中讀出的值為 :TERRAILLON+%28SPAIN+SHIPMENT%29怎麼把它變成:"TERRAILLON (SPAIN SHIPMENT)"strcom_name.search("+")會出錯。 先encode写入cookie,读出时decode IE5.5以下自己别程序替换,IE5.5+用<script>alert(decodeURI("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));alert(decodeURIComponent("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));</script> 我是用escape和unescape解决的:<SCRIPT LANGUAGE="JavaScript"><!--function getCookieByName(name){var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg))return unescape(arr[2]);elsereturn null} //改装了以前从秋水那里弄来的读cookie的函数function setCookie(name,value){document.cookie= name+"="+escape(value)}setCookie("test","TERRAILLON (SPAIN SHIPMENT)");alert(getCookieByName("test"))//--></SCRIPT> thanks to all!三星級大俠 qiushuiwuhen(秋水无恨):您好!<script>alert(decodeURI("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));alert(decodeURIComponent("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));</script>我能在 jscript 中找到這兩個函數的參考,它們在 javascript 中也一樣???在 jscript 中有的東西在javascript也有??? wsh只能用在jscript中吧,不能用在javascript中吧???replace(/\+/g," "))是什麼意思??煩請您回答!! http://www.blueidea.com/bbs/newsdetail.asp?id=523379里有个urldecoding JQuery 下拉框问题 为什么单击flash控件,单击事件不起作用? 求一个图片轮换的代码 用JS怎么实现? 如何将被十六进制编码的汉字还原为可以正常浏览的汉字? 问一取值? <img>和<div>中间的空隙怎么去掉 我是笨蛋蛋蛋,被javascipt搞疯了,高手速来,高分等待 有关dialogArguments的问题 sos!怎样实现滚动新闻?最好有源代码。谢谢! 大家谁知道,那个3721是用什么技术装进我的系统的?我觉得很奇怪 请教!
TERRAILLON+%28SPAIN+SHIPMENT%29
怎麼把它變成:"TERRAILLON (SPAIN SHIPMENT)"
strcom_name.search("+")會出錯。
<script>
alert(decodeURI("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));alert(decodeURIComponent("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));
</script>
<!--
function getCookieByName(name){
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null
} //改装了以前从秋水那里弄来的读cookie的函数function setCookie(name,value){
document.cookie= name+"="+escape(value)
}setCookie("test","TERRAILLON (SPAIN SHIPMENT)");
alert(getCookieByName("test"))//-->
</SCRIPT>
您好!<script>
alert(decodeURI("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));alert(decodeURIComponent("TERRAILLON+%28SPAIN+SHIPMENT%29").replace(/\+/g," "));
</script>我能在 jscript 中找到這兩個函數的參考,它們在 javascript 中也一樣???在 jscript 中有的東西在javascript也有??? wsh只能用在jscript中吧,不能用在javascript中吧???replace(/\+/g," "))是什麼意思??煩請您回答!!
里有个urldecoding