开发者

Jquery Replace Function, if there is a way

one of my clients is making posts trough WordPad so it adds an extra tag each time he posts, and it's crashing IE.

What i want to do is put a jquery function to replace:

<!--[if !supportLists]-->

with:

<!--[if !supportLists] --> (With a space after [)

within whole document.

Is there an easy way do make it work? or should i use开发者_如何学JAVA PHP?

thanks


Replace function :

function replaceAll(str, from, to)
{
    return str.split(from).join(to);
}

You can also use prototype on String :

String.prototype.replaceAll(from, to)
{
    return this.split(from).join(to);
}

Or I didn't understand your question properly...


Eventhough you do add the space, will it work? I mean, the page gets loaded and then the space will be added. So if IE crashes, won't it crash even before the space is added?

So youre friend just has to use "find and replace" (CTRL + F, if im correct) and replace the first tag with the second (correct) one.

Don't know if this is correct, i'm not a PHP specialist but:
str_replace("<!--[if !supportLists]-->", "< !--[if !supportLists] -->") would that work?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜