作家
登录

js FLASH幻灯片字符串中有连接符&的处理方法

作者: 来源:www.28hudong.com 2013-03-30 00:32:38 阅读 我要评论

复制代码 代码如下: <script type="text/javascript"> varconfig='6|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000'; varfiles='http://www.jb51.net/bbs/attachments/month_1001/10010519247f1786dc556829c5.jpg|http://www.jb51.net/bbs/attachments/month_1001/1001060845f046a796b52d112f.jpg|http://www.jb51.net/bbs/attachments/month_1001/10010812174b26936d6961598a.png|http://www.jb51.net/bbs/attachments/month_1001/1001061531c89399912d217be4.png|http://www.jb51.net/bbs/ttachments/month_1001/1001071315a59155ffb750a427.jpg|http://www.jb51.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年PPT模板|【模板参选】中国移动援博2009年PPT模板|超酷CIG企業演示PPT|急求:立体的对号和错号|2010年标 新|画轴开启、书法动画、画轴闭合'; 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://www.jb51.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://www.jb51.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> 经过测试可以单独对links进行处理即可 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 对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decodeURIComponent 1、 传递参数时需要使用encodeURIComponent,这样组合的url才不会被#等特殊字符截断。 例如: 2、 进行url跳转时可以整体使用encodeURI 例如:Location.href="/encodeURI"("http://www.jb51.net/s?word=百度&ct=21"); 3、 js使用数据时可以使用escape 例如:搜藏中history纪录。 4、 escape对0-255以外的unicode值进行编码时输出%u****格式,其它情况下escape,encodeURI,encodeURIComponent编码结果相同。 最多使用的应为encodeURIComponent,它是将中文、韩文等特殊字符转换成utf-8格式的url编码,所以如果给后台传递参数需要使用encodeURIComponent时需要后台解码对utf-8支持(form中的编码方式和当前页面编码方式相同) escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z

  推荐阅读

  Node.js实战 建立简单的Web服务器

前面一章,我们介绍了Node.js这个面向互联网服务的JavaScript服务器平台,同时Node.js的运行环境已经搭建起来,并通过两段HelloWorld程序验证了Node.js的基本功能。本章我们同样通过实战的演练,利用Node.js建立一个>>>详细阅读


本文标题:js FLASH幻灯片字符串中有连接符&的处理方法

地址:http://www.17bianji.com/kaifa2/JS/23593.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)