Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在脚本中使用 replace() 方法,但它在 9 版之前的 Internet Explorer 中不起作用!
因此,以下代码也在 IE < 9 中返回“访问 Microsoft”!
var str="Visit Microsoft!"; var n=str.replace("Microsoft","Sara");
replace()适用于大多数浏览器(AFAIK 也 IE6、IE7)。
replace()
顺便说一句,您可以使用此功能从头开始实现它。
http://phpjs.org/functions/str_replace/