欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在asp中使用js的encodeURIComponent方法

 更新時(shí)間:2012年03月01日 15:45:09   作者:  
encodeURIComponent 方法返回一個(gè)已編碼的 URI。如果您將編碼結(jié)果傳遞給 decodeURIComponent,那么將返回初始的字符串
大家知道,在js里encodeURIComponent 方法是一個(gè)比較常用的編碼方法,但因工作需要,在asp里需用到此方法,查了好多資料,沒(méi)有很好的方法,最后用了下面這個(gè)方法,基本解決了問(wèn)題。
復(fù)制代碼 代碼如下:

<%
Function aspEncodeURIComponent(sStr)
aspEncodeURIComponent = myEncodeURIComponent(sStr)
%>
<script language="javascript" type="text/javascript" runat="server">
function myEncodeURIComponent(sStr){
return encodeURIComponent(sStr);
}
</script>
<%
End Function
%>

附注:

encodeURIComponent 方法
將文本字符串編碼為一個(gè)統(tǒng)一資源標(biāo)識(shí)符 (URI) 的一個(gè)有效組件。

encodeURIComponent(encodedURIString)

必選的 encodedURIString 參數(shù)代表一個(gè)已編碼的 URI 組件。

說(shuō)明
encodeURIComponent 方法返回一個(gè)已編碼的 URI。如果您將編碼結(jié)果傳遞給 decodeURIComponent,那么將返回初始的字符串。因?yàn)?encodeURIComponent 方法對(duì)所有的字符編碼,請(qǐng)注意,如果該字符串代表一個(gè)路徑,例如 /folder1/folder2/default.html,其中的斜杠也將被編碼。這樣一來(lái),當(dāng)該編碼結(jié)果被作為請(qǐng)求發(fā)送到 web 服務(wù)器時(shí)將是無(wú)效的。如果字符串中包含不止一個(gè) URI 組件,請(qǐng)使用 encodeURI 方法進(jìn)行編碼。

相關(guān)文章

最新評(píng)論