function replace()
{
var str="tao zhang yi love liu weng ling";
re=new RegExp("l","g");
var newstart=str.replace(re,"t");
alert(newstr);
}
运行结果:弹出"tao zhang yi tove tiu weng ting";
function replace()
{
var str="tao zhang yi love liu weng ling";
re=new RegExp("l","g");
var newstart=str.replace(re,"t");
alert(newstr);
}