htmledit.js

来自「PHP留言本 设计流程: 1.需求分析: 留言本要是实现的功能是用户留言」· JavaScript 代码 · 共 68 行

JS
68
字号
function replace(string,text,by) 
{
		// from www.irt.org, supposedly..
        if (string.length==0 || text.length==0) return string;
        var i = string.indexOf(text);
        if (((!i) && (text != string.substring(0,text.length))) || (i== -1)) return string;
        var newstr = string.substring(0,i) + by;
        if (i+text.length < string.length) newstr += replace(string.substring(i+ text.length, string.length), text, by);
        return newstr;
}
/*
function c2e(text) 
{
        text=replace(text,"\r","");
        text=replace(text,"\n","<BR>\n");
        text = replace(text,"<SCRIPT>","#SCRIPT#");
        text = replace(text,"</SC"+"RIPT>","#/SCRIPT#");
        text = replace(text,"<BR>\n<UL>","\n<UL>");
        text = replace(text,"<UL><BR>","<UL>");
        text = replace(text,"</UL><BR>","</UL>");
        text = replace(text,"<BR>\n<OL>","\n<OL>");
        text = replace(text,"<OL><BR>","<OL>");
        text = replace(text,"</OL><BR>","</OL>");
        text = replace(text,"<BR>\n<LI>", "\n<LI>");
        return text;
}
*/
function e2c(text) 
{
        // first, kick out some absolute url's
        //myloc=document.URL;
        //myloc=replace(myloc, "pivot/log.php","");
        //text=replace(text, myloc, "");
        //text=replace(text, "pivot/log.php","");
        //text=replace(text,"<BR>","\n");
        //text=replace(text,"<P>","");
        //text=replace(text,"</P>","<br>");
        text=replace(text,"STRONG>","B>");
        text=replace(text,"EM>","I>");
        text=replace(text,"/UL>\r\n","/UL>");
        text=replace(text,"/OL>\r\n","/OL>");
        text=replace(text,"#SCRIPT#","<SCRIPT>");
        text=replace(text,"#/SCRIPT#","</SC"+"RIPT>");
		text=replace(text,"<A","<A target='_blank'");
        return text;
}
/*
function copycontenttoedit(){
        text=c2e(document.all.f_introduction.value)+" ";
        document.frames['edit'].setHTML(text);
}
*/
function copyedittocontent()
{
        text=e2c(document.frames['edit'].getHTML());
        document.all.Content.value=text;
}

function setInitHtml()
{
return szInitHTML;
}

function Selface(faceid)
{
document.htmlForm.Face.value=faceid;
document.all.Curface.src="images/manto/"+faceid+".gif";
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?