JavaScript decodeURIComponent()関数

1371 ワード

JavaScriptグローバルオブジェクトリファレンスマニュアル

定義と使用法


decodeURIComponent()関数は、encodeURIComponent()関数で符号化されたURIを復号することができる.

構文

decodeURIComponent(URIstring)

パラメータの説明
URIstring
必要です.符号化URIコンポーネントまたは他の復号するテキストを含む文字列.

戻り値


16進数エスケープシーケンスは、それらが表す文字に置き換えられるURIstringのコピー.

≪インスタンス|Instance|emdw≫


この例では、decodeURIComponent()を使用して、符号化されたURIを復号します.
<script type="text/javascript">

var test1="http://www.w3school.com.cn/My first/"

document.write(encodeURIComponent(test1)+ "<br />")
document.write(decodeURIComponent(test1))

</script>

出力:
http%3A%2F%2Fwww.w3school.com.cn%2FMy%20first%2F
http://www.w3school.com.cn/My first/

TIY


decodeURIComponent()
符号化されたURIをdecodeURIComponent()を使用して復号する方法.
JavaScriptグローバルオブジェクトリファレンスマニュアル