开发者

how to replace € into € with javascript?

i'm trying to fix this forum where html entities are not displayed correctly. since the o开发者_C百科wner is m.i.a. i'm trying to do this with an extension.

what i see on my screen:

euro:€
pound:£ 

view of the html DOM with firebug

how to replace € into € with javascript?

my code:

GM_log('before text= '+text); 
text.replace( /amp;/gi, function( $0 ) {
    GM_log('$0= '+$0);
    fix="";
    return fix; 
});
GM_log(' after text= '+text); 

which returns:

 before text= euro: &amp;#8364; <br>pound: &amp;#163;
 $0= amp;
 $0= amp;
 after text= euro: &amp;#8364; <br>pound: &amp;#163;

so my code seems to be working until the point it has to replace.

are those rectangles preventing it? did i do something wrong?

and if so how can i fix this?

thanks.


You forgot to assign the result of replace:

text = text.replace(...);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜