运用jdk
源代码在线查看: w.js
var css1 = ('A:link{TEXT-DECORATION: none;COLOR: #336699;}A:visited{TEXT-DECORATION: none;COLOR: #336699;}A:hover{TEXT-DECORATION: underline;COLOR: #666666;}A:active{TEXT-DECORATION: none;COLOR: #336699;}BODY,TD,TH{FONT-FAMILY: 宋体;FONT-SIZE: 14px;COLOR: #000000;}');
var css2 = ('');
function initEditor () {
EditCtrl.document.designMode="ON";
EditCtrl.document.open();
EditCtrl.document.write(css1);
EditCtrl.document.write(css2);
EditCtrl.document.close();
}
function format (what,opt){
selectRange ();
if (what == "small" || what == "big")
{
var strHTML;
if (RangeType == "Text")
{
edittxt = ""+edit.text+"";
edit.pasteHTML (edittxt);
}
}
else
{
if ( opt == "")
{
EditCtrl.document.execCommand (what);
}
}
if (opt != "" && opt != null && what != "saveas") {
EditCtrl.document.execCommand (what,"",opt);
}
EditCtrl.focus ();
}
function selectRange () {
EditCtrl.focus ();
edit = EditCtrl.document.selection.createRange();
RangeType = EditCtrl.document.selection.type;
}