📄 textedit.htc
字号:
<public:component name="urd" urn="urd" lightweight="true">
<public:property name="left" put="putLeft" />
<public:property name="top" put="putTop" />
<public:property name="width" put="putWidth" />
<public:property name="height" put="putHeight" />
<public:property name="init" put="initialize" />
<script Language="Javascript">
var vLeft = 0;
var vTop = 0;
var vWidth = 400;
var vHeight = 500;
var sLinkFieldName = "content1" ;
var yToolbars = new Array(); // 工具栏数组
var nCurrZoomSize = 100;
var aZoomSize = new Array(10, 25, 50, 75, 100, 150, 200, 500);
// 全局设置对象
var config = new Object() ;
config.Version = "望海康信" ;
config.ReleaseDate = "2005-07-10" ;
config.StyleName = "standard";
config.StyleEditorHeader = "<head><link href=\"../css/Editor.css\" type=\"text/css\" rel=\"stylesheet\"></head><body MONOSPACE>" ;
config.StyleMenuHeader = "<head><link href=\"../css/MenuArea.css\" type=\"text/css\" rel=\"stylesheet\"></head><body scroll=\"no\" onConTextMenu=\"event.returnValue=false;\">";
config.StyleDir = "standard";
config.StyleUploadDir = "UploadFile/";
config.InitMode = "EDIT";
config.AutoDetectPasteFromWord = true;
config.BaseUrl = 1;
config.AutoRemote = 1;
// 当前模式
var sCurrMode = null;
var bEditMode = null;
// 连接对象
var oLinkField = null;
var sBaseUrl = "file://";
// 浏览器版本检测
var BrowserInfo = new Object() ;
BrowserInfo.MajorVer = navigator.appVersion.match(/MSIE (.)/)[1] ;
BrowserInfo.MinorVer = navigator.appVersion.match(/MSIE .\.(.)/)[1] ;
BrowserInfo.IsIE55OrMore = BrowserInfo.MajorVer >= 6 || ( BrowserInfo.MajorVer >= 5 && BrowserInfo.MinorVer >= 5 ) ;
// 当文档完全调入时,进行初始化
var bInitialized = false;
var objUserTextEditContainers;
/////////////////////////////////////////////////////////////////////////刘鹏飞新作begin
function initialize(){
//------------------------------------------生成页面--------------------------------------//
var strUserReportDesignerTitleHTML = "";
strUserReportDesignerTitleHTML = "<table border=1 cellpadding=0 cellspacing=0 width='100%' height='100%'><tr><td>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<table border=1 cellpadding=0 cellspacing=0 width='100%' class='Toolbar' id='eWebEditor_Toolbar'><tr><td>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<div class='yToolbar'><DIV CLASS=\"TBHandle\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<SELECT CLASS=\"TBGen\" onchange=\"format('FormatBlock',this[this.selectedIndex].value);this.selectedIndex=0\"><option selected>段落样式</option><option value=\"<P>\">普通</option> <option value=\"<H1>\">标题一</option> <option value=\"<H2>\">标题二</option> <option value=\"<H3>\">标题三</option><option value=\"<H4>\">标题四</option> <option value=\"<H5>\">标题五</option> <option value=\"<H6>\">标题六</option> <option value=\"<p>\">段落</option> <option value=\"<dd>\">定义</option> <option value=\"<dt>\">术语定义</option> <option value=\"<dir>\">目录列表</option> <option value=\"<menu>\">菜单列表</option> <option value=\"<PRE>\">已编排格式</option> </SELECT> ";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<SELECT CLASS=\"TBGen\" onchange=\"format('fontname',this[this.selectedIndex].value);this.selectedIndex=0\"><option selected>字体</option><option value=\"宋体\">宋体</option><option value=\"黑体\">黑体</option><option value=\"楷体_GB2312\">楷体</option><option value=\"仿宋_GB2312\">仿宋</option><option value=\"隶书\">隶书</option><option value=\"幼圆\">幼圆</option><option value=\"Arial\">Arial</option><option value=\"Arial Black\">Arial Black</option><option value=\"Arial Narrow\">Arial Narrow</option><option value=\"Brush Script MT\">Brush Script MT</option><option value=\"Century Gothic\">Century Gothic</option> <option value=\"Comic Sans MS\">Comic Sans MS</option> <option value=\"Courier\">Courier</option> <option value=\"Courier New\">Courier New</option> <option value=\"MS Sans Serif\">MS Sans Serif</option> <option value=\"Script\">Script</option> <option value=\"System\">System</option> <option value=\"Times New Roman\">Times New Roman</option> <option value=\"Verdana\">Verdana</option> <option value=\"Wide Latin\">Wide Latin</option> <option value=\"Wingdings\">Wingdings</option> </SELECT>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<SELECT CLASS=\"TBGen\" onchange=\"format('fontsize',this[this.selectedIndex].value);this.selectedIndex=0\"> <option selected>字号</option> <option value=\"7\">一号</option> <option value=\"6\">二号</option> <option value=\"5\">三号</option> <option value=\"4\">四号</option> <option value=\"3\">五号</option> <option value=\"2\">六号</option> <option value=\"1\">七号</option></SELECT>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<SELECT CLASS=\"TBGen\" onchange=\"doZoom(this[this.selectedIndex].value)\"> <option value=\"10\">10%</option> <option value=\"25\">25%</option> <option value=\"50\">50%</option> <option value=\"75\">75%</option> <option value=\"100\" selected>100%</option> <option value=\"150\">150%</option> <option value=\"200\">200%</option><option value=\"500\">500%</option></SELECT>";
//粗体
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"粗体\" onclick=\"format('bold')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/bold.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"斜体\" onclick=\"format('italic')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/italic.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"下划线\" onclick=\"format('underline')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/underline.gif\"> </DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"TBSep\"></DIV><DIV CLASS=\"Btn\" TITLE=\"左对齐\" onclick=\"format('justifyleft')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/justifyleft.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"居中对齐\" onclick=\"format('justifycenter')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/justifycenter.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"右对齐\" onclick=\"format('justifyright')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/justifyright.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"两端对齐\" onclick=\"format('JustifyFull')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/justifyfull.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"TBSep\"></DIV><DIV CLASS=\"Btn\" TITLE=\"删除文字格式\" onclick=\"format('RemoveFormat')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/removeformat.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"中划线\" onclick=\"format('StrikeThrough')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/strikethrough.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"上标\" onclick=\"format('superscript')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/superscript.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"下标\" onclick=\"format('subscript')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/subscript.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"全部选中\" onclick=\"format('SelectAll')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/selectall.gif\"></DIV><DIV CLASS=\"TBSep\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"取消选择\" onclick=\"format('Unselect')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/unselect.gif\"></DIV></div>";
//strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"TBSep\"></DIV><DIV CLASS=\"Btn\" TITLE=\"编号\" onclick=\"format('insertorderedlist')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/insertorderedlist.gif\"></DIV>";
//strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"项目符号\" onclick=\"format('insertunorderedlist')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/insertunorderedlist.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "</td></tr><tr><td><div class='yToolbar'><DIV CLASS=\"TBHandle\"></DIV>";//hhhh
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"编号\" onclick=\"format('insertorderedlist')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/insertorderedlist.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"项目符号\" onclick=\"format('insertunorderedlist')\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/insertunorderedlist.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV id=\"eWebEditor_Temp_HTML\" CLASS=\"TBSep\"></DIV><DIV CLASS=\"Btn\" TITLE=\"字体颜色\" onclick=\"ShowDialog('../htc/selcolor.htm?action=forecolor', 280, 250, true)\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/forecolor.gif\"></DIV>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<DIV CLASS=\"Btn\" TITLE=\"字体背景颜色\" onclick=\"ShowDialog_backcolor('../htc/selcolor.htm?action=backcolor', 280, 250, true)\"><IMG CLASS=\"Ico\" SRC=\"../htm/images/backcolor.gif\"></DIV></div>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "</td></tr></table>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "</td></tr><tr><td height='100%'>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'><tr><td height='100%'>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<input type=\"hidden\" ID=\"ContentEdit\" value=\"\">";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<input type=\"hidden\" ID=\"ContentLoad\" value=\"\">";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<input type=\"hidden\" ID=\"ContentFlag\" value=\"0\">";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<iframe class=\"Composition\" ID=\"eWebEditor\" MARGINHEIGHT=\"1\" MARGINWIDTH=\"1\" width=\"100%\" height=\"100%\" scrolling=\"yes\"></iframe>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "</td></tr></table></td></tr><tr><td height=25>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<TABLE border=\"0\" cellPadding=\"0\" cellSpacing=\"0\" width=\"100%\" class=StatusBar height=25><TR valign=middle><td>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<table border=0 cellpadding=0 cellspacing=0 height=20><tr><td width=10></td><td class=StatusBarBtnOff id=eWebEditor_CODE onclick=\"setMode('CODE')\"><img border=0 src=\"../htm/images/modecode.gif\" width=50 height=15 align=absmiddle></td>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<td width=5></td><td class=StatusBarBtnOff id=eWebEditor_EDIT onclick=\"setMode('EDIT')\">";
//编辑
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<img border=0 src=\"../htm/images/modeedit.gif\" width=50 height=15 align=absmiddle></td>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + " <td width=5></td><td class=StatusBarBtnOff id=eWebEditor_VIEW onclick=\"setMode('VIEW')\"><img border=0 src=\"../htm/images/modepreview.gif\" width=50 height=15 align=absmiddle>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "</td></tr></table></td><td align=right>";
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<table border=0 cellpadding=0 cellspacing=0 height=20><tr><td style=\"cursor:pointer;\" onclick=\"sizeChange(300)\"><img border=0 SRC=\"../htm/images/showdetails.gif\" width=20 height=20 alt=\"取值\"><span>取值</span></td>";//
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<td width=5></td><td style=\"cursor:pointer;\" onclick=\"sizeChange(-300)\"></td>";//<img border=0 SRC=\"images/sizeminus.gif\" width=20 height=20 alt=\"减小编辑区\">
strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<td width=40></td></tr></table></td></TR></Table></td></tr></table>";
//NEW
//strUserReportDesignerTitleHTML = strUserReportDesignerTitleHTML + "<div id=\"eWebEditor_Temp_HTML\" style=\"VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px\"></div>";
objUserTextEditContainers = window.document.createElement("<div class='PENGtextedit_Containers'>");
objUserTextEditContainers.style.height = vHeight;
objUserTextEditContainers.style.width = vWidth;
objUserTextEditContainers.style.top = vTop;
objUserTextEditContainers.style.left = vLeft;
objUserTextEditContainers = element.appendChild(objUserTextEditContainers);
objUserTextEditContainers.style.visibility = "visible";
objUserTextEditContainers.insertAdjacentHTML("afterBegin",strUserReportDesignerTitleHTML);
window.document.body.scroll = "no";
objUserTextEditContainers.oncontextmenu = function (){return false;};
//总表格
objTextEditTable = objUserTextEditContainers.children(0);
///////////////////////////////////////table////////tbody////.......tr.......td......table////////tbody///////tr/////////////td............div
objSelect1 = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(1);
objSelect1.onchange = objSelect1onchange;
objSelect2 = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(2);
objSelect2.onchange = objSelect2onchange;
objSelect3 = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(3);
objSelect3.onchange = objSelect3onchange;
objSelect4 = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(4);
objSelect4.onchange = objSelect4onchange;
//////////////////////////////////////////////////字体
objFontB = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(5);
objFontI = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(6);
objFontU = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(7);
//////////////////////////////////////////////////对齐方式
objFontAlignLeft = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(9);
objFontAlignCenter = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(10);
objFontAlignRight = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(11);
objFontAlignFull = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(12);
/////////////////////////////////////////////////////
objDel = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(14);
objCenterLine = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(15);
objTop = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(16);
objBottom = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(17);
objSelectAll = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(18);
objCancelSelect = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(20);
///////////////////////////////////////////////////行序号和符号
objNumber = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(1).children(0).children(0).children(0);
objSign = objUserTextEditContainers.children(0).children(0).children(0).children(0).children(0).children(0).children(1).children(0).children(0).children(1);
//总表格第er行
/////////////////////////////table///////tbody///////tr////////////td///////////table/////tbody//////tr/////////td/////////
objContentEdit = objUserTextEditContainers.children(0).children(0).children(1).children(0).children(0).children(0).children(0).children(0).children(0);
objContentLoad = objUserTextEditContainers.children(0).children(0).children(1).children(0).children(0).children(0).children(0).children(0).children(1);
objContentFlag = objUserTextEditContainers.children(0).children(0).children(1).children(0).children(0).children(0).children(0).children(0).children(2);
objeWebEditor = objUserTextEditContainers.children(0).children(0).children(1).children(0).children(0).children(0).children(0).children(0).children(3);
/////////////////////////////table///////tbody///////tr////////////td///////////table/////tbody//////tr/////////td///////////table///////tbody.......tr///////
//总表格第san行
objCode = objUserTextEditContainers.children(0).children(0).children(2).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(1);
objCode.onclick = SetCodeMode;
objEdit = objUserTextEditContainers.children(0).children(0).children(2).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(3);
objEdit.onclick = SetEditMode;
objPreview = objUserTextEditContainers.children(0).children(0).children(2).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(0).children(5);
objPreview.onclick = SetPreviewMode;
objGetHtml = objUserTextEditContainers.children(0).children(0).children(2).children(0).children(0).children(0).children(0).children(1).children(0).children(0).children(0).children(0);
objGetHtml.onclick = getHTML;
//------------------------------调用原函数document.onreadystatechange()---------------------------//
onload();
}
////////////////////////////////////////////selecct
function objSelect1onchange(){
format('FormatBlock',objSelect1[objSelect1.selectedIndex].value);
objSelect1.selectedIndex = 0;
}
function objSelect2onchange(){
format('fontname',objSelect2[objSelect2.selectedIndex].value);
objSelect2.selectedIndex=0;
}
function objSelect3onchange(){
format('fontsize',objSelect3[objSelect3.selectedIndex].value);
objSelect3.selectedIndex=0;
}
function objSelect4onchange(){
doZoom(objSelect4[objSelect4.selectedIndex].value);
}
function SetEditMode(){
setMode('EDIT');
}
function SetCodeMode(){
setMode('CODE');
}
function SetPreviewMode(){
setMode('VIEW');
}
//function document.onreadystatechange()
function onload(){
//因为不存在所以删掉
//if (document.readyState!="complete") return;
if (bInitialized) return;
bInitialized = true;
var i, s, curr;
// 初始每个工具栏
for (i = 0; i < objUserTextEditContainers.all.length ; i++){
curr=objUserTextEditContainers.all[i];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -