?? editor.asp
字號:
PrevTB = TB;
TB = yToolbars[i];
CurrWid = TB.TBWidth;
if ((Start + CurrWid) > ScrWid) {
Start = 0;
LastWid = TotalLen - LastStart;
}
else {
LastWid = PrevTB.TBWidth;
RelTop -= TB.offsetHeight;
}
TB.style.posTop = RelTop;
TB.style.posLeft = Start;
PrevTB.style.width = LastWid;
LastStart = Start;
Start += CurrWid;
}
TB.style.width = TotalLen - LastStart;
i--;
TB = yToolbars[i];
var TBInd = TB.sourceIndex;
var A = TB.document.all;
var item;
for (i in A) {
item = A.item(i);
if (! item) continue;
if (! item.style) continue;
if (item.sourceIndex <= TBInd) continue;
if (item.style.position == "absolute") continue;
item.style.posTop = RelTop;
}
}
function DoLayout()
{
LayoutTBs();
}
function BtnMouseOver()
{
if (event.srcElement.tagName != "IMG") return false;
var image = event.srcElement;
var element = image.parentElement;
if (image.className == "Ico") element.className = "BtnMouseOverUp";
else if (image.className == "IcoDown") element.className = "BtnMouseOverDown";
event.cancelBubble = true;
}
function BtnMouseOut()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
yRaisedElement = null;
element.className = "Btn";
image.className = "Ico";
event.cancelBubble = true;
}
function BtnMouseDown()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
event.returnValue=false;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
element.className = "BtnMouseOverDown";
image.className = "IcoDown";
event.cancelBubble = true;
event.returnValue=false;
return false;
}
function BtnMouseUp()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
element.className = "BtnMouseOverUp";
image.className = "Ico";
event.cancelBubble = true;
return false;
}
function getEl(sTag,start)
{
while ((start!=null) && (start.tagName!=sTag)) start = start.parentElement;
return start;
}
function cleanHtml()
{
var fonts = HtmlEdit.document.body.all.tags("FONT");
var curr;
for (var i = fonts.length - 1; i >= 0; i--) {
curr = fonts[i];
if (curr.style.backgroundColor == "#ffffff") curr.outerHTML = curr.innerHTML;
}
}
function getPureHtml()
{
var str = "";
var paras = HtmlEdit.document.body.all.tags("P");
if (paras.length > 0) {
for (var i=paras.length-1; i >= 0; i--) str = paras[i].innerHTML + "\n" + str;
}
else {
str = HtmlEdit.document.body.innerHTML;
}
return str;
}
function Editor()
{
this.put_HtmlMode=setMode;
this.put_value=putText;
this.get_value=getText;
}
function getText()
{
if (bTextMode)
return HtmlEdit.document.body.innerText;
else
{
cleanHtml();
cleanHtml();
return HtmlEdit.document.body.innerHTML;
}
}
function putText(v)
{
if (bTextMode)
HtmlEdit.document.body.innerText = v;
else
HtmlEdit.document.body.innerHTML = v;
}
function UserDialog(what)
{
if (!validateMode()) return;
HtmlEdit.document.execCommand(what, true);
pureText = false;
HtmlEdit.focus();
}
function validateMode()
{
if (! bTextMode) return true;
alert("請取消“查看HTML源代碼”選項,然后再使用系統編輯功能!");
HtmlEdit.focus();
return false;
}
function format(what,opt)
{
if (!validateMode()) return;
if (opt=="removeFormat")
{
what=opt;
opt=null;
}
if (opt==null) HtmlEdit.document.execCommand(what);
else HtmlEdit.document.execCommand(what,"",opt);
pureText = false;
HtmlEdit.focus();
}
function setMode(newMode)
{
var cont;
bTextMode = newMode;
if (bTextMode) {
cleanHtml();
cleanHtml();
cont=HtmlEdit.document.body.innerHTML;
HtmlEdit.document.body.innerText=cont;
}
else {
cont=HtmlEdit.document.body.innerText;
HtmlEdit.document.body.innerHTML=cont;
}
HtmlEdit.focus();
}
function foreColor()
{
if (! validateMode()) return;
var arr = showModalDialog("selcolor.asp", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
if (arr != null) format('forecolor', arr);
else HtmlEdit.focus();
}
function InsertTable()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("table.asp", "", "dialogWidth:300pt;dialogHeight:236pt;help:0;status:0");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function InsertImg()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("image.asp", "", "dialogWidth:430px; dialogHeight:230px; status:0");
if (arr != null)
{
range.pasteHTML(arr);
parent.myform.IncludePic.checked=true;
}
HtmlEdit.focus();
}
function specialtype(Mark){
if (!Error()) return;
var sel,RangeType
sel = HtmlEdit.document.selection.createRange();
RangeType = HtmlEdit.document.selection.type;
if (RangeType == "Text"){
sel.pasteHTML("<" + Mark + ">" + sel.text + "</" + Mark + ">");
sel.select();
}
HtmlEdit.focus();
}
function help()
{
var arr = showModalDialog("help.asp", "", "dialogWidth:580px; dialogHeight:460px; status:0");
}
function save()
{
if (bTextMode){
//編輯器嵌入其他網頁時使用下面這一句(請將form1改成相應表單名)
parent.myform.Content.value=HtmlEdit.document.body.innerText;
//單獨打開編輯器時使用下面這一句(請將form1改成相應表單名)
// self.opener.form1.content.value+=HtmlEdit.document.body.innerText;
}
else{
//編輯器嵌入其他網頁時使用下面這一句(請將form1改成相應表單名)
parent.myform.Content.value=HtmlEdit.document.body.innerHTML;
//單獨打開編輯器時使用下面這一句(請將form1改成相應表單名)
// self.opener.form1.content.value+=HtmlEdit.document.body.innerHTML;
}
HtmlEdit.focus();
return false;
}
</script>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -