我要往html里面插入代码 需要转换
类似:text = text.replace(/\n/g,"<br>");
先要将text = text.replace(??这里正则怎么写,"<!--newpage-->");我想像<br>一样 输出就可以了
类似:text = text.replace(/\n/g,"<br>");
先要将text = text.replace(??这里正则怎么写,"<!--newpage-->");我想像<br>一样 输出就可以了
insertHTML("<br>")
break;
case "nextpage":
insertHTML("<!--newpage-->"); //我现在要插入这么到html代码中去 break;function insertHTML(html) {
if (isModeView()) {return false;}
eWebEditor.focus();
if (eWebEditor.document.selection.type.toLowerCase() != "none"){
eWebEditor.document.selection.clear() ;
}
if (sCurrMode!="EDIT"){
html=HTMLEncode(html);
}
eWebEditor.document.selection.createRange().pasteHTML(html) ;
}
function HTMLEncode(text){
text = text.replace(/&/g, "&") ;
text = text.replace(/"/g, """) ;
text = text.replace(/</g, "<") ;
text = text.replace(/>/g, ">") ;
text = text.replace(/\ /g," ");
text = text.replace(/\n/g,"<br>");
text = text.replace(/\n/g,"<!--newpage-->");
text = text.replace(/\t/g," ");
return text;
}