0

我需要在脚本中使用 replace() 方法,但它在 9 版之前的 Internet Explorer 中不起作用!

因此,以下代码也在 IE < 9 中返回“访问 Microsoft”!

var str="Visit Microsoft!";
var n=str.replace("Microsoft","Sara");
4

1 回答 1

0

replace()适用于大多数浏览器(AFAIK 也 IE6、IE7)。

顺便说一句,您可以使用此功能从头开始实现它。

http://phpjs.org/functions/str_replace/

于 2013-02-10T19:11:21.147 回答