www.pudn.com > WebDesign.rar > text.js


function fnToolBar () 
{ 
	var path="../images/"; 
	var buttons = new Array (8,23,23,23,4,23,23,4,23,23,23,4,23,23,23,25); 
	var action = new Array ("","bold","italic","underline","","small","big","","justifyleft","justifycenter","justifyright","","insertorderedlist","insertunorderedlist","outdent","indent"); 
	var tooltip = new Array ("","加粗","倾斜","下划线","","减小字号","增大字号","","左对齐","居中","右对齐","","编号","项目符号","减少缩进量","增加缩进量"); 
	var left = 0,s = ""; 
	for (var i=0; i"; 
		left += buttons[i];} 
	document.write (s); 
} 
function posts(){ 
	msg = EditCtrl.document.body.innerHTML; 
	document.form1.Content.value = msg; 
	document.form1.submit() 
} 
 
function selectRange(){ 
	EditCtrl.focus(); 
	edit = EditCtrl.document.selection.createRange(); 
	RangeType =  EditCtrl.document.selection.type; 
} 
function format (what,opt) { 
	selectRange (); 
	if (what == "newmsg" && confirm ("新建文档原来的内容将删除,确定要新建吗?新建文档前建议先保存文档。")) { 
		EditCtrl.document.body.innerHTML = ''; 
	} 
	else if (what == "saveas") { 
		var wst = document.form1.title.value; 
		if (wst == "") { 
			wst = "No Title"; 
		} 
		var winSave = window.open(); 
		var wd = winSave.document; 
		wd.open (); 
		wd.write (css1); 
		wd.write (EditCtrl.document.body.innerHTML); 
		wd.write (css2); 
		wd.close (); 
		wd.execCommand ("SaveAs","",wst); 
		winSave.close (); 
	} 
	else if (what == "table") { 
		var tables = showModalDialog (path+"table.htm", "", "dialogWidth:23.6em; dialogHeight:11.3em; status:0"); 
		if (tables != null) { 
			edit.pasteHTML (tables); 
		} 
	} 
	else if (what == "small" || what == "big") { 
		var strHTML; 
		if (RangeType == "Text"){ 
			edittxt = "<"+what+">"+edit.text+""; 
			edit.pasteHTML (edittxt); 
		} 
	} 
	else if (what == "pic") { 
		if (RangeType == "Control") { 
			EditCtrl.document.execCommand("InsertImage",true); 
		} 
		else { 
			var images = showModalDialog (path+"pic.htm", "", "dialogWidth:30em; dialogHeight:13em; status:0"); 
			if (images != null) { 
				edit.pasteHTML (images); 
			} 
		} 
	} 
	else if (what == "link") { 
		EditCtrl.document.execCommand("CreateLink",true); 
	} 
	else if (opt == "") { 
		if (what == "ForeColor") { 
			opt = prompt("请您定义所选取的文字的颜色。",""); 
		} 
	else if (what == "FontName") { 
		opt = prompt("请您定义所选取的文字的字体。",""); 
		} 
		else { 
			EditCtrl.document.execCommand (what); 
		} 
	} 
	if (opt != "" && opt != null && what != "saveas") { 
		EditCtrl.document.execCommand (what,"",opt); 
	} 
	EditCtrl.focus (); 
} 
function initEditor () 
{ 
	EditCtrl.document.designMode="On"; 
}