涿州市查建设局网站,长沙专业网站建设品牌,应用下载app,子轩wordpress公文中二级标题的一般以#xff08;X#xff09;标注#xff08;其中X为由一二三四五六七八九十中的字符组成的字符串#xff09;#xff0c;用楷体字加粗。 首先我们要判断一段文字是否包含二级标题#xff0c;最简单的方法 就是判断文字中的头一个字符是否…公文中二级标题的一般以X标注其中X为由一二三四五六七八九十中的字符组成的字符串用楷体字加粗。 首先我们要判断一段文字是否包含二级标题最简单的方法 就是判断文字中的头一个字符是否为或如果是就包含二级标题否则就不包含二级标题。即 var t p[0];if (t( || t ){//alert(t);return 2;//二级标题}
但是有些人可能会用㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩来做序号而且4级标题x其中x为0~9组成的字符串也是以或开头的。
所以我们写了一个isIncludeSecondaryTitle()来进行判断并修改getTitleLevel()函数加入二级标题的判断
//Is a secondary title serial number with parenthesis是带小括号的二级标题序号吗
function isT2SNwithParenthesis(p)
{var t p[0];if (t (){t p.indexOf());if ((-1 ! t) ((p.substring(1,t)).isCnNum())) {return true;}}//ifif (t ){t p.indexOf();if ((-1 ! t) (p.substring(1,t).isCnNum())) {return true;}}//ifreturn false;//二级标题
}//isSNwithParenthesis(p)//Is the paragraph with secondary title?二级标题
function isIncludeSecondaryTitle(p)
{var t p[0];//t p.substring(0, 1);if (-1! ㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩.indexOf(t)){return true;}if (isT2SNwithParenthesis(p)){return true;//二级标题}return false;
}//isIncludeSecondaryTitle(p) //功能获取文字串的标题级别
//输入p文字串
//输出1一级标题2二级标题3三级标题0其它
function getTitleLevel(p)
{taDbg.value \n---getTitleLevel: p;var t p[0];//t p.substring(0, 1);if (t( || t ){//alert(t);return 2;//二级标题}if (isIncludePrimaryTitle(p))//一级标题{return 1;}//三级标题/*return 3;*/return 0;
}//getTitleLevel(p)
需要注意的是这里我们没有考虑以序号中的小括号一个为中文小括号另一个为英文小括号的情况如【注左边为中文小括号右边为英文小括号】或(【注左边为英文小括号右边为中文小括号】。
然后我们修改setParaFmt()调用 setParaTitle2()来完成二级标题段落的排版。
//功能设置段落格式set paragraph format
//输入p段落文字
//输出设置格式的文本
function setParaFmt(p)
{switch (getTitleLevel(p)){case 1:t setParaTitle1(p);//一级标题break;case 2:t setParaTitle2(p);//二级标题break;
/*case 3:t setParaTitle3(p);//三级标题break;
*/default: //main text正文t p styleline-height: rs pt; text-indent: sn em;font-family: mtfn ; font-size: mtfs pt; p;}//switchreturn t;
} //功能设置二级标题set paragraph format with secondary title
//输入t文字
//输出格式化字符串
function setParaTitle2(t)
{taDbg.value \n---setParaTitle2: t;var r;if (ptIsALine(t)) //标题是否单独成行{//return p stylefont-family: fn ;font-size: fs pt; text-align: ta ; line-height: rs pt; s;r p stylefont-family: st2fn ;font-size: st2fs pt; line-height: rs pt; text-indent: sn em; (st2Strong ? font-weight: bold; : ) t;}else{//标题不单独成行var n t.indexOf(。);r p styleline-height: rs pt; text-indent: sn em; font-size: st2fs pt; font-family: mtfn span stylefont-family: st2fn (st2Strong ? ;font-weight: bold; : ) t.substring(0, n) /span t.substring(n);}return r;
}//setParaTitle2(t)
在setParaTitle2()中我们调用ptIsALine()来判断段落是否只含标题。
//功能标题是否单独成行 Is paragraph title a single line?
//输入t文字
//输出true是独立标题行false不是独立标题行
function ptIsALine(t)
{var r false;var n t.indexOf(。);if (n(t.length-1))//句号是否位于段末{r true;//有且只有一个。}else{if (!t.isEndWithPunctuation())//未以标点符号结尾{r true;}}return r;
}
由于ptIsALine()只检测中文句号所以在测试中我们会发现以问号结尾的二级标题没有被识别出来。
通常表示一个语句结束的标点符号有。…我们都必须都考虑进去。
因此我们需要修改ptIsALine()代码如下
String.prototype.isEnPunctuation function()
{
/*var reg /[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/;return (reg.test(c)) ? true : false;
*/return (/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(this)) ? true : false;
}//功能判断是否为中文或英文标点符号
String.prototype.isPunctuation function()
{ //return ((/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(this)) || (/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(this))) ? true : false; return (this.isEnPunctuation() || this.isCnPunctuation()) ? true : false; }//功能是否以标点符号结束Is aunctuation at the end of the string
String.prototype.isEndWithPunctuation function()
{
/*var c this.substring(this.length-1);return c.isPunctuation();
*/return this.substring(this.length-1).isPunctuation();
}var sStatementEndPunctuation 。?….!?;//语句结束符号//功能获取段落文字中的第一个语句结束符号位置
//输入p:字符串
//输出第一个语句结束符号位置
function getFirstPunctuationPos(p)
{//taDbg.value \n ---getFirstPunctuationPos( p )\n;var r p.length, n;for (var i 0; i sStatementEndPunctuation.length; i){n p.indexOf(sStatementEndPunctuation[i]);if ( (-1 ! n) (n r) ){r n;//taDbg.value \n sStatementEndPunctuation[i] n n r r;}}return r;
}//getFirstPunctuationPos(p)//功能判断字符串是否只有一句话
//输入p:字符串
//输出true是一句话false不是一句话
function isAstatement(p)
{var n getFirstPunctuationPos(p);return ((( -1 ! n) (n p.length-1)) ? true : false);
}//功能标题是否单独成行 Is paragraph title a single line?
//输入t文字
//输出true是独立标题行false不是独立标题行
function ptIsALine(t)
{return (!t.isEndWithPunctuation()) ? true : isAstatement(t) ;
} //ptIsALine(t)
如果段落除了二级标题还有其他内容的话我们需要把二级标题文字按二级标题格式设置其他内容按正文格式设置。因为二级标题文字语句的结束标点符号可能是句号也可能是问号、感叹号……所以我们还要对setParaTitle1()和setParaTitle2()作相应的修改
//功能设置一级标题set paragraph format with primay title
//输入t文字
//输出格式化字符串
function setParaTitle1(t)
{var r;if (ptIsALine(t)) //标题是否单独成行{//return p stylefont-family: fn ;font-size: fs pt; text-align: ta ; line-height: rs pt; s;r p stylefont-family: pt1fn ;font-size: pt1fs pt; line-height: rs pt; text-indent: sn em; t;}else{//标题不单独成行var n getFirstPunctuationPos(t);//t.indexOf(。);r p styleline-height: rs pt; text-indent: sn em; font-family: mtfn span stylefont-family: pt1fn ;font-size: pt1fs pt; t.substring(0, n) /span t.substring(n);}taDbg.value \n---setParaTitle1: r;return r;
} //setParaTitle1(t)//功能设置二级标题set paragraph format with secondary title
//输入t文字
//输出格式化字符串
function setParaTitle2(t)
{taDbg.value \n---setParaTitle2: t;var r;if (ptIsALine(t)) //标题是否单独成行{//return p stylefont-family: fn ;font-size: fs pt; text-align: ta ; line-height: rs pt; s;r p stylefont-family: st2fn ;font-size: st2fs pt; line-height: rs pt; text-indent: sn em; (st2Strong ? font-weight: bold; : ) t;}else{//标题不单独成行var n getFirstPunctuationPos(t);r p styleline-height: rs pt; text-indent: sn em; font-size: st2fs pt; font-family: mtfn span stylefont-family: st2fn (st2Strong ? ;font-weight: bold; : ) t.substring(0, n) /span t.substring(n);}return r;
}//setParaTitle2(t)
代码运行效果如下 其中(二影视网站风险大 因为序号左边小括号为英文小括号右边括号为中文小括号所以没有按二级标题来设置格式。
完整代码如下
!DOCTYPE HTML
html
head
meta http-equivContent-Type contenttext/html; charsetutf-8 /
title公文一键排版/title
meta nameauthor contentpurpleendurer
meta namedescription content公文一键排版
script typetext/javascript
const aFontName [方正小标宋简体,//0黑体,//1微软雅黑,//2仿宋_GB2312,//3仿宋,//4楷体_GB2312,//5楷体,//6宋体,//7Arial,//8Wingdings 2//9
];//sId:select control id, iDefSel:default selected
function showFontNameSel(sId, iDefSel)
{document.write(select id, sId, width50);for (var i 0; i aFontName.length; i){document.write(option value, aFontName[i], );document.write(iiDefSel ? selected : );document.write(aFontName[i],/option);}document.write(/select);
}
const aFontSize [[初号, 42],//0[小初, 36],//1[一号, 26],//2[小一, 24],//3[二号, 22],//4[小二, 18],//5[三号, 16],//6[小三, 15],//7[四号, 14],//8[小四, 12],//9[五号, 10.5], //10[小五, 9],//11[六号, 7.5],//12[小六, 6.5],//13[七号, 5.5],//14[八号, 5]//15
];//sId:select control id, iDefSel:default selected
function showFontSizeSel(sId, iDefSel)
{document.write(select id, sId, );for (var i 0; i aFontSize.length; i){document.write(option value,aFontSize[i][1], );document.write(iiDefSel ? selected : );document.write(aFontSize[i][0],/option);}document.write(/select);
}const aAlign [[左对齐,left],//0[居中对齐,center],//1[右对齐,right],//2[两端分散对齐,justify]//3
];//sId:select control id, iDefSel:default selected
function showAlignSel(sId, iDefSel)
{document.write(select id, sId, );for (var i 0; i aAlign.length; i){document.write(option value,aAlign[i][1], );document.write(iiDefSel ? selected : );document.write(aAlign[i][0],/option);}document.write(/select);
}function showSrc()
{if (btnShowSrc.value显示源码){edRichBody.innerText edRichBody.innerHTML;btnShowSrc.value 显示预览;btnShowSrc.style.background cyan;}else{edRichBody.innerHTML edRichBody.innerText;btnShowSrc.value 显示源码;btnShowSrc.style.background yellow;}
}function stripPattribs(s)
{var i s.indexOf();return ((-1 ! i) ? s.substr(i1) : s);
}String.prototype.stripHTML function()
{var reTag /(?:.|\s)*?/g; //var reTag /[^]/gi; //过滤所有html标签但不包括html标签内的内容 return this.replace(reTag,);
}String.prototype.trim function()
{//去除首尾空格return this.replace(/(^\s*)|(\s*$)/g, ); /*var t this.replace(/(^\s*)|(\s*$)/g, ); return t t.replace(/(^nbsp;*)|(nbsp*$)/g, ); */
} function getClearInfoArray()
{taDbg.value \n---getClearInfoArray()\n;var s edRichBody.innerHTML;var t s.split(p);for (var i0; i t.length; i){taDbg.value \nt[ i ] t[i];} while (t[0].length0 || t[0]/p){taDbg.value \nshift: t[0];t.shift();}while (t[t.length-1].length0 || t[t.length-1]/p){taDbg.value \npop: t[t.length-1];t.pop();}for (var i0; i t.length; i){t[i] stripPattribs(t[i]);t[i] t[i].stripHTML();//以下两句顺序不能颠倒t[i] t[i].replace(/nbsp;/ig, ); //去除空格代码 nbsp;t[i] t[i].trim(); //去除首尾空格}while (t[t.length-1].length0 || t[t.length-1]/p){taDbg.value \npop: t[t.length-1];t.pop();}taDbg.value \n---\n;for (var i0; i t.length; i){taDbg.value \nt[ i ] t[i];} return t;
}function clearDocFmt()
{var s p getClearInfoArray().join(/pp);edRichBody.innerHTML s;
} //判断是否为中文标点符号
String.prototype.isCnPunctuation function()
{
/*var reg /[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/;return (reg.test(this)) ? true : false;
*/return (/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(this)) ? true : false;
}//判断是否为英文标点符号
String.prototype.isEnPunctuation function()
{
/*var reg /[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/;return (reg.test(c)) ? true : false;
*/return (/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(this)) ? true : false;
}//功能判断是否为中文或英文标点符号
String.prototype.isPunctuation function()
{ //return ((/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(this)) || (/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(this))) ? true : false; return (this.isEnPunctuation() || this.isCnPunctuation()) ? true : false; }//功能是否以标点符号结束Is aunctuation at the end of the string
String.prototype.isEndWithPunctuation function()
{
/*var c this.substring(this.length-1);return c.isPunctuation();
*/return this.substring(this.length-1).isPunctuation();
}var sStatementEndPunctuation 。?….!?;//语句结束符号//功能获取段落文字中的第一个语句结束符号位置
//输入p:字符串
//输出第一个语句结束符号位置
function getFirstPunctuationPos(p)
{//taDbg.value \n ---getFirstPunctuationPos( p )\n;var r p.length, n;for (var i 0; i sStatementEndPunctuation.length; i){n p.indexOf(sStatementEndPunctuation[i]);if ( (-1 ! n) (n r) ){r n;//taDbg.value \n sStatementEndPunctuation[i] n n r r;}}return r;
}//getFirstPunctuationPos(p)//功能判断字符串是否只有一句话
//输入p:字符串
//输出true是一句话false不是一句话
function isAstatement(p)
{
/*for (var i 0; i sStatementEndPunctuation.length; i){var n p.indexOf(sStatementEndPunctuation[i]);if (n !-1 n p.length-1) {return true;}}return false;
*/var n getFirstPunctuationPos(p);return ((( -1 ! n) (n p.length-1)) ? true : false);
}//功能标题是否单独成行 Is paragraph title a single line?
//输入t文字
//输出true是独立标题行false不是独立标题行
function ptIsALine(t)
{
/*var r false;var n t.indexOf(。);if (n(t.length-1)) //句号是否位于段末{r true;//有且只有一个。}else{if (!t.isEndWithPunctuation())//未以标点符号结尾{r true;}}return r;
*//*if (!t.isEndWithPunctuation())//未以标点符号结尾{return true;}return (isAstatement(t));
*/return (!t.isEndWithPunctuation()) ? true : isAstatement(t) ;
} //ptIsALine(t) //功能设置一级标题set paragraph format with primay title
//输入t文字
//输出格式化字符串
function setParaTitle1(t)
{var r;if (ptIsALine(t)) //标题是否单独成行{//return p stylefont-family: fn ;font-size: fs pt; text-align: ta ; line-height: rs pt; s;r p stylefont-family: pt1fn ;font-size: pt1fs pt; line-height: rs pt; text-indent: sn em; t;}else{//标题不单独成行var n getFirstPunctuationPos(t);//t.indexOf(。);r p styleline-height: rs pt; text-indent: sn em; font-family: mtfn span stylefont-family: pt1fn ;font-size: pt1fs pt; t.substring(0, n) /span t.substring(n);}taDbg.value \n---setParaTitle1: r;return r;
} //setParaTitle1(t)//功能设置二级标题set paragraph format with secondary title
//输入t文字
//输出格式化字符串
function setParaTitle2(t)
{taDbg.value \n---setParaTitle2: t;var r;if (ptIsALine(t)) //标题是否单独成行{//return p stylefont-family: fn ;font-size: fs pt; text-align: ta ; line-height: rs pt; s;r p stylefont-family: st2fn ;font-size: st2fs pt; line-height: rs pt; text-indent: sn em; (st2Strong ? font-weight: bold; : ) t;}else{//标题不单独成行var n getFirstPunctuationPos(t);r p styleline-height: rs pt; text-indent: sn em; font-size: st2fs pt; font-family: mtfn span stylefont-family: st2fn (st2Strong ? ;font-weight: bold; : ) t.substring(0, n) /span t.substring(n);}return r;
}//setParaTitle2(t)//是否为只包含一二三四五六七八九十的字符串
String.prototype.isCnNum function()
{//[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341] [一二三四五六七八九十]return (/^[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341]$/.test(this));
}//Is the paragraph with primary title?一级标题
function isIncludePrimaryTitle(p)
{var t p.indexOf(、);return ((-1 ! t) (p.substring(0,t).isCnNum())) ? true : false;//return /^[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341][\u3001]{1}/.test(p); //可匹配“ 十一、三四”中的“十一、”//return /^\s*[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341][\u3001]{1}/.test(p); //可匹配“ 十一、三四”或“ 十一、三四”中的“十一、”//(\b[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341])*[\u3001]{1}可匹配“十一、三四”中的顿号//\b[\u4e00|\u4e8c|\u4e09|\u56db|\u4e94|\u516d|\u4e03|\u516b|\u4e5d|\u5341]*[\u3001]{1}可匹配“a十一、三四”中的“十一、”
}//isIncludePrimaryTitle(p)//Is a secondary title serial number with parenthesis是带小括号的二级标题序号吗
function isT2SNwithParenthesis(p)
{var t p[0];if (t (){t p.indexOf());if ((-1 ! t) ((p.substring(1,t)).isCnNum())) {return true;}}//ifif (t ){t p.indexOf();if ((-1 ! t) (p.substring(1,t).isCnNum())) {return true;}}//ifreturn false;//二级标题
}//isSNwithParenthesis(p)//Is the paragraph with secondary title?二级标题
function isIncludeSecondaryTitle(p)
{var t p[0];//t p.substring(0, 1);if (-1! ㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩.indexOf(t)){return true;}if (isT2SNwithParenthesis(p)){return true;//二级标题}return false;
}//isIncludeSecondaryTitle(p) //功能获取文字串的标题级别
//输入p文字串
//输出1一级标题2二级标题3三级标题0其它
function getTitleLevel(p)
{taDbg.value \n---getTitleLevel: p;if (isIncludeSecondaryTitle(p)){//alert(t);return 2;//二级标题}if (isIncludePrimaryTitle(p))//一级标题{return 1;}//三级标题/*return 3;*/return 0;
}//getTitleLevel(p) //功能设置段落格式set paragraph format
//输入p段落文字
//输出设置格式的文本
function setParaFmt(p)
{switch (getTitleLevel(p)){case 1:t setParaTitle1(p);//一级标题break;case 2:t setParaTitle2(p);//二级标题break;
/*case 3:t setParaTitle3(p);//三级标题break;
*/default: //main text正文t p styleline-height: rs pt; text-indent: sn em;font-family: mtfn ; font-size: mtfs pt; p;}//switchreturn t;
} function setDocTitle(s)
{taDbg.value \n--- setDocTitle( s ); ;return p stylefont-family: dtfn ;font-size: dtfs pt; text-align: dtta ; line-height: rs pt; s;
}function getArg()
{// 排版内容包括公文标题cbDocTilte document.getElementById(cbDocTilte).checked;//标题字体名 document title font namedtfn document.getElementById(selDocTitleFontName).value;//alert(fn);//标题字号 document title font sizedtfs document.getElementById(selDocTitleFontSize).value;//alert(fs);//标题对齐方式 document title text aligndtta document.getElementById(selDocTitleAlign).value;//一级标题字号 primary title font namept1fn document.getElementById(selPrimaryTitleFontName).value;//一级标题字号 primary titlefont sizept1fs document.getElementById(selPrimaryTitleFontSize).value;//二级标题字号 psecondary title font namest2fn document.getElementById(selSecondaryTitleFontName).value;//二级标题字号 secondary title font sizest2fs document.getElementById(selSecondaryTitleFontSize).value;//二级标题字体加粗 secondary title strongst2Strong document.getElementById(cbSecondaryTitleStrong).checked;//三级标题字体加粗 third title strongtt3Strong document.getElementById(cbThirdTitleStrong).checked;//正文字体名称mtfn document.getElementById(selMainTextFontName).value;//正文字体字号mtfs document.getElementById(selMainTextFontSize).value;//行距 row spacingrs document.getElementById(tbRowSp).value;//首行行首空格数sn document.getElementById(tbLeadSpNum).value;
}// getArg()function setDocFmt()
{taDbg.value \n---setDocFmt()\n;getArg();var t getClearInfoArray();//标题if (cbDocTilte){t[0] setDocTitle(t[0]) /pp styleline-height: rs nbsp;;}for (var i (cbDocTilte ? 1: 0); i t.length; i){t[i] setParaFmt(t[i]);} edRichBody.innerHTML t.join();
}//setDocFmt() /script
/head
body
fieldset stylewidth: 1100px;legend实时编辑区/legend
!--
iframe ideditor width600px height200px styleborder: solid 1px; srchttp://nyncj.hechi.gov.cn/iframe
//--iframe ideditor width1200px height400px styleborder: solid 1px;/iframe
/fieldset
pinput typebutton idbtnclearDocFmt value清除格式 onclickclearDocFmt() /input typebutton idbtnsetDocFmt value一键排版 onclicksetDocFmt() /input typebutton idbtnShowSrc value显示源码 onclickshowSrc() stylebackground:yellow; border-radius: 25px; /input typebutton idbtnB valueB title加粗/正常 stylefont-weight:bolder onclickexecCmd(bold,false,null) /input typebutton idbtnItalic valueI title斜体/正常 stylefont-weight:bolder;font-style:italic onclickexecCmd(italic,false,null) /
/p
fieldset stylewidth: 1200px;legend参数设置/legend公文标题input typecheckbox checked idcbDocTilte排版内容包括公文标题scriptshowFontNameSel(selDocTitleFontName, 0);document.write( );showFontSizeSel(selDocTitleFontSize, 4);document.write( );showAlignSel(selDocTitleAlign, 1);/scriptp正文一级标题scriptshowFontNameSel(selPrimaryTitleFontName, 1);document.write( );showFontSizeSel(selPrimaryTitleFontSize, 6);/script/pp正文二级标题scriptshowFontNameSel(selSecondaryTitleFontName, 5);document.write( );showFontSizeSel(selSecondaryTitleFontSize, 6);/scriptinput typecheckbox checked idcbSecondaryTitleStrong粗体/pp正文三级标题input typecheckbox checked idcbThirdTitleStrong粗体/pp正文 scriptshowFontNameSel(selMainTextFontName, 3);document.write( );showFontSizeSel(selMainTextFontSize, 6);document.write( );/script行距行间距input typetext idtbRowSp value28 size2!-- row spacing//-- 段落首行行首空格数input typetext idtbLeadSpNum value2 size2/P/fieldset!--
input typetext idpath valuehttps://www.google.com.hk/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png /
input typebutton idinsert_img value插入图片 /
//--p调试信息/p
textarea idtaDbg stylewidth: 1225px; height: 200px调试信息/textareascript typetext/javascriptconst edRich document.getElementById(editor);
const taDbg document.getElementById(taDbg);
const btnShowSrc document.getElementById(btnShowSrc);//排版内容是否包括公文标题
var cbDocTilte; // document.getElementById(cbDocTilte).value;
//标题字体名 document title font name
var dtfn; // document.getElementById(selDocTitleFontName).value;
//标题字号 document title font size
var dtfs; // document.getElementById(selDocTitleFontSize).value;
//标题对齐方式 document title text align
var dtta;// document.getElementById(selDocTitleAlign).value;//一级标题字号 font name
var pt1fn; // document.getElementById(selPrimaryTitleFontName).value;
//一级标题字号 font size
var pt1fs; // document.getElementById(selPrimaryTitleFontSize).value;//二级标题字号 psecondary title font name
var st2fn; // document.getElementById(selSecondaryTitleFontName).value;
//二级标题字号 secondary title font size
var st2fs; // document.getElementById(selSecondaryTitleFontSize).value;
//二级标题字体加粗 secondary title strong
var st2Strong; // document.getElementById(cbSecondaryTitleStrong).value;//三级标题字体加粗 third title strong
var tt3Strong; // document.getElementById(cbThirdTitleStrong).value;//行距 row spacingvar rs; // document.getElementById(tbRowSp).value;
//首行行首空格数var sn; // document.getElementById(tbLeadSpNum).value;//正文字体名称
var mtfn; // document.getElementById(selMainTextFontName).value;//正文字体字号
var mtfs; // document.getElementById(selMainTextFontSize).value;
var edRichDoc;
var edRichBody;
//var edRichHTML;
if (typeof(edRich) !undefined){edRichDoc edRich.contentWindow.document;edRichDoc.designMode on;edRichDoc.contentEditable true;edRichBody edRichDoc.body;//edRichHTML edRichDoc.body.innerHTML;//edRich.contentWindow.document.body.innerHTML a hrefttp://nyncj.hechi.gov.cnabc/a;//edRichHTML a hrefhttp://nyncj.hechi.gov.cnabc/a; edRichBody.innerHTML pa hrefhttp://blog.csdn.net/purpleendurerhttp://blog.csdn.net/purpleendurer/a/pp/pp stylefont-family:方正小标宋简体;font-size:22pt; text-align:center; line-height:28pt;p aligncenter styletext-align:center;text-indent:24.0pt;line-height:28.0ptspan langEN-US stylefont-size:22.0pt;font-family:方正小标宋简体;mso-hansi-font-family:黑体;color:blackSQL/spanspan stylefont-size:22.0pt;font-family:方正小标宋简体;mso-hansi-font-family:黑体;color:black注入基础span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;font-family:黑体;color:black一、span langEN-USSQL/span注入分类span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxbspan stylefont-size:16.0pt;font-family:楷体_GB2312;color:black一什么是span langEN-USSQL/span注入span langEN-US?o:p/o:p/span/span/b/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan langEN-US stylefont-size:16.0pt;font-family:仿宋_GB2312;color:blackSLQ/spanspan stylefont-size:16.0pt;font-family:仿宋_GB2312;color:black注入span langEN-US(/span英文span langEN-US: Sqlinject)/span当span langEN-USweb/span应用向后台数据库传递span langEN-USSQL/span语句进行数据库操作时如果对用户输入的参数没有经过严格的过滤那么用户可以构造特殊的span langEN-USsq1/span语句从而带入到数据库中执行获取或修改数据库中的数据。span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxbspan langEN-US stylefont-size:16.0pt;font-family:楷体_GB2312;color:black(/span/bbspan stylefont-size:16.0pt;font-family:楷体_GB2312;color:black二影视网站风险大span langEN-USo:p/o:p/span/span/b/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;font-family:仿宋_GB2312;color:black例如很多影视网站泄露span langEN-USVIP/span会员密码大多就是通过span langEN-USSQL/span注入漏洞暴露的这类网站特别容易受到span langEN-USSQL/span注入攻击。span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxbspan stylefont-size:16.0pt;font-family:楷体_GB2312;color:black三防范技术span langEN-USo:p/o:p/span/span/b/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;font-family:宋体;color:blacknbsp;nbsp;加强……span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxbspan stylefont-size:16.0pt;font-family:宋体;color:black四本章小结。span langEN-USo:p/o:p/span/span/b/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;font-family:宋体;color:black要……/span/pp styletext-align:center㈤习题/p;
}
else
{window.alert(undefined);
}function replaceStr(s1,s2)
{try{var r document.body.createTextRange();if (r.findText(s1)){r.expand(charactor);r.select();r.text s2;r.scrollIntoView();}else{alert(s not found!);}}catch (e){alert(e.description);}
}function showSrc()
{if (btnShowSrc.value显示源码){edRichBody.innerText edRichBody.innerHTML;btnShowSrc.value 显示预览;btnShowSrc.style.background cyan;}else{edRichBody.innerHTML edRichBody.innerText;btnShowSrc.value 显示源码;btnShowSrc.style.background yellow;}
}function execCmd(cmd,f,v)
{edRichDoc.execCommand(cmd,f,v);
}
/script
/body
/html