用 JavaScript 中的空格替换 %20

use*_*441 1 html javascript

嗨,我目前正在处理一个 html 表单,将表单数据从一个 html 表单传递到另一个表单。显示数据时,我%20在每个空间的位置。有没有办法替换这个?

我在接收页面中的代码是:

<script type = "text/javascript"> 
    document.write("Business Name:  ", BusinessName);<-- Variables that are passed through URL-->
    document.write("Business Type:  ", BusinessType);
    document.write("Business Purpose:  ", BusinessPurpose);
</script>
Run Code Online (Sandbox Code Playgroud)

Man*_*arz 5

unescape()

您的字符串是 url 编码的。就unescape这样。

unescape("asd%20asd")
-> "asd asd"
Run Code Online (Sandbox Code Playgroud)