語法:encodeURIComponent(URIstring)
參數(shù):URIstring,必需。一個(gè)字符串,含有 URI 組件或其他要編碼的文本。
document.write(encodeURIComponent("http://zijieyoumin.cn/encodeurl.html?我是個(gè)中文參數(shù)")) document.write("<br />") document.write(encodeURIComponent(",/?:@&=+$#"))結(jié)果
http%3A%2F%2Fzijieyoumin.cn%2Fencodeurl.html%3F%E6%88%91%E6%98%AF%E4%B8%AA%E4%B8%AD%E6%96%87%E5%8F%82%E6%95%B0 %3Cbr%20%2F%3E %2C%2F%3F%3A%40%26%3D%2B%24%23測(cè)試
document.write(encodeURI("http://zijieyoumin.cn/encodeurl.html?我是個(gè)中文參數(shù)")) document.write("<br />") document.write(encodeURI(",/?:@&=+$#"))結(jié)果
http://zijieyoumin.cn/encodeurl.html?%E6%88%91%E6%98%AF%E4%B8%AA%E4%B8%AD%E6%96%87%E5%8F%82%E6%95%B0 %3Cbr%20/%3E ,/?:@&=+$#
請(qǐng)注意 encodeURIComponent() 函數(shù) 與 encodeURI() 函數(shù)的區(qū)別之處,前者假定它的參數(shù)是 URI 的一部分(比如協(xié)議、主機(jī)名、路徑或查詢字符串)。因此 encodeURIComponent() 函數(shù)將轉(zhuǎn)義用于分隔 URI 各個(gè)部分的標(biāo)點(diǎn)符號(hào)。
綜合技術(shù)交流:點(diǎn)擊加入--> [SO JSON官方交流①群][收費(fèi)]
綜合技術(shù)交流:點(diǎn)擊加入--> [SO JSON官方交流②群][免費(fèi)]
要求:不能發(fā)廣告、暴力、政治、付費(fèi)教程,違者直接踢出。
備注:入群費(fèi)用5元,沒有QQ錢包,可以先支付寶
or 微信
掃碼支付5元贊助后,我拉您進(jìn)去。QQ聯(lián)系我。
掃碼贊助:贊助二維碼。
技術(shù)交流QQ群:①群259217951,②群166848545
站長郵箱:so@sojson.com
對(duì)頁面內(nèi)容有任何疑問和建議,請(qǐng)聯(lián)系我們。
所有贊助/開支都講公開明細(xì),用于網(wǎng)站維護(hù):贊助名單查看
正在加載... ...