JavaScript 中的 decodeURIComponent() 函数
htmljavascriptprogramming scripts更新于 2024/10/17 11:56:17
decodeURIComponent() 函数接受表示编码 URI(统一资源标识符)的字符串值,对其进行解码并返回结果。
语法
其语法如下
encodeURIComponent('http://www.qries.com/');
示例
<html>
<head>
<title>JavaScript 示例</title>
</head>
<body>
<script type="text/javascript">
var encodedData = encodeURIComponent('http://www.qries.com/?x=шеллы');
document.write("Encoded Data: "+encodedData);
document.write("<br>");
var decodedData = decodeURIComponent(encodedData);
document.write("Decoded Data: "+decodedData);
</script>
</body>
</html>
输出
Encoded Data: http%3A%2F%2Fwww.qries.com%2F%3Fx%3D%D1%88%D0%B5%D0%BB%D0%BB%D1%8B Decoded Data: http://www.qries.com/?x=шеллы
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

