Skip to main content
 首页 » 编程设计

Javascript之替换 '%20' 空格

2025年12月25日31Terrylee

var loc_array = document.location.href.split('/'); 
var linkElement = document.getElementById("waBackButton"); 
var newT = document.createTextNode(loc_array[loc_array.length-2]);  
var repl = newT.replace('%20',' '); 
linkElement.appendChild(repl); 

有人知道为什么这会导致文本不显示吗?

请您参考如下方法:

为什么不做

unescape(document.location.href);