最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js FLASH幻燈片字符串中有連接符&的處理方法

 更新時(shí)間:2012年03月01日 15:23:15   作者:  
一般情況下我們?cè)贔LASH幻燈片字符串中有連接符時(shí)點(diǎn)擊鏈接就會(huì)不正常,造成鏈接中的參數(shù)丟失,那么就需要用encodeURIComponent來(lái)對(duì)鏈接地址進(jìn)行編碼
復(fù)制代碼 代碼如下:

<script type="text/javascript">
varconfig='6|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000';
varfiles='http://m.fzitv.net/bbs/attachments/month_1001/10010519247f1786dc556829c5.jpg|http://m.fzitv.net/bbs/attachments/month_1001/1001060845f046a796b52d112f.jpg|http://m.fzitv.net/bbs/attachments/month_1001/10010812174b26936d6961598a.png|http://m.fzitv.net/bbs/attachments/month_1001/1001061531c89399912d217be4.png|http://m.fzitv.net/bbs/ttachments/month_1001/1001071315a59155ffb750a427.jpg|http://m.fzitv.net/bbs/attachments/month_1001/1001071933febe3e795de1dcdb.jpg';
varlinks='PageView.asp?id=36&cid=42&Lid=34|PageView.asp?id=36&cid=42|http://www.renren.com|http://www.ifeng.com/|http://www.tudou.com/|http://www.http://www.skycn.com/';
vartexts='【模板參選】華為2009年P(guān)PT模板|【模板參選】中國(guó)移動(dòng)援博2009年P(guān)PT模板|超酷CIG企業(yè)演示PPT|急求:立體的對(duì)號(hào)和錯(cuò)號(hào)|2010年標(biāo) 新|畫(huà)軸開(kāi)啟、書(shū)法動(dòng)畫(huà)、畫(huà)軸閉合';
varflashvars=[
'config='+encodeURIComponent(config)
,'files='+encodeURIComponent(files)
,'links='+encodeURIComponent(links)
,'texts='+encodeURIComponent(texts)
].join("&");
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="198">');
document.write('<param name="movie" value="http://m.fzitv.net/bbs/images/xshow/focus.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<param name="flashvars" value="'+flashvars+'" />');
document.write('<embed src="http://m.fzitv.net/bbs/images/xshow/focus.swf" wmode="opaque" flashvars="'+flashvars+'" menu="false" quality="high" width="100%" height="198" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
</script>

經(jīng)過(guò)測(cè)試可以單獨(dú)對(duì)links進(jìn)行處理即可
document.write('<param name="FlashVars" value="pics='+pics522+'&links='+encodeURIComponent(links522)+'&texts='+texts522+'&borderwidth='+focus_width522+'&borderheight='+focus_height522+'&textheight='+text_height522+'">');
js編碼之 encodeURIComponent

js 對(duì)文字進(jìn)行編碼涉及3個(gè)函數(shù):escape,encodeURI,encodeURIComponent,相應(yīng)3個(gè)解碼函數(shù):unescape,decodeURI,decodeURIComponent
1、 傳遞參數(shù)時(shí)需要使用encodeURIComponent,這樣組合的url才不會(huì)被#等特殊字符截?cái)唷?
例如:
2、 進(jìn)行url跳轉(zhuǎn)時(shí)可以整體使用encodeURI
例如:Location.href="/encodeURI"("http://m.fzitv.net/s?word=百度&ct=21");
3、 js使用數(shù)據(jù)時(shí)可以使用escape
例如:搜藏中history紀(jì)錄。
4、 escape對(duì)0-255以外的unicode值進(jìn)行編碼時(shí)輸出%u****格式,其它情況下escape,encodeURI,encodeURIComponent編碼結(jié)果相同。
最多使用的應(yīng)為encodeURIComponent,它是將中文、韓文等特殊字符轉(zhuǎn)換成utf-8格式的url編碼,所以如果給后臺(tái)傳遞參數(shù)需要使用encodeURIComponent時(shí)需要后臺(tái)解碼對(duì)utf-8支持(form中的編碼方式和當(dāng)前頁(yè)面編碼方式相同)
escape不編碼字符有69個(gè):*,+,-,.,/,@,_,0-9,a-z,A-Z
encodeURI不編碼字符有82個(gè):!,#,$,&,\',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z
encodeURIComponent不編碼字符有71個(gè):!, \',(,),*,-,.,_,~,0-9,a-z,A-Z

相關(guān)文章

最新評(píng)論

蓬安县| 莎车县| 九龙坡区| 巫溪县| 宕昌县| 榆树市| 垫江县| 周口市| 申扎县| 昌江| 丹东市| 叶城县| 乌兰察布市| 和田县| 麟游县| 巨野县| 阳谷县| 南雄市| 句容市| 天水市| 漳平市| 洪雅县| 广平县| 汶上县| 钦州市| 河西区| 蓬溪县| 新竹市| 宜都市| 巴南区| 锡林郭勒盟| 堆龙德庆县| 桦甸市| 广州市| 札达县| 黄梅县| 文成县| 远安县| 翁源县| 曲阳县| 宜章县|