⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subjectedit.js

📁 自行开发的考核系统的后台数据库为sql2000。解压后是3个文件
💻 JS
📖 第 1 页 / 共 2 页
字号:
function SetBackColor(color) {
	var colorsArray = new Array(
			"#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff",
			"#ff0000","#000080","#008080","#008000","#800080",
			"#800000","#808000","#808080","#c0c0c0","#000000");
	var edgeColor = "#AAAAAA";
	var autoStyle = (isAutoBackColor) ? 'TextEdit_ButtonDown' : 'TextEdit_ButtonNormal';
	
	var str = "";
	str += "<table cellpadding='0' cellspacing='0' style='display:inline;border-top: 1px solid "+edgeColor+";"+
			"border-left: 1px solid "+edgeColor+";border-right: 1px solid "+edgeColor+";border-bottom:0px;'>"+
			"<tr><td width='29' height='20'></td></tr></table>"+
			"<table width='64' cellpadding='0' cellspacing='0' border='0' style='display:inline;' bgcolor='#0f0f0f'>"+
			"<tr><td height='1' bgcolor='"+edgeColor+"'></td></tr></table>"+
			"<table cellpadding='0' cellspacing='0' height='62' border='0' style='display:block;'>"+
			"<tr><td height='62' style='border-left: 1px solid "+edgeColor+";"+
			"border-right: 1px solid "+edgeColor+"; border-bottom: 1px solid "+edgeColor+"'>"+
			"<table cellpadding='0' cellspacing='3' style='background-color:#FFFFFF;'>"+
			"<tr><td height='22' class='"+autoStyle+"' align='center' onmouseover='ButtonOver(this);'"+
			" onmouseout='ButtonOut(this);'"+
			" onmousedown='SetColor(\"#FFFFFF\",\"BackColor\",\"backcolor\",\"backcolorpicket\");isAutoBackColor=true;'>"+
			"无</td></tr>"+
			"<tr><td align='center'>";	str += "<table cellspacing='0' border='1' bordercolor='#FFFFFF' noWrap>"
	for (var i=0;i<3;i++) {
		str += "<tr>";
		for (var j=0;j<5;j++) {
			str += "<td width='13' height='13' style='padding: 1px;' align='center'";
			if (color == colorsArray[5*i+j])
				str += " class='TextEdit_ButtonDown'";
			str += " onmouseover='ButtonOver(this);' onmouseout='ButtonOut(this);' "+
					" onmousedown='SetColor(\""+colorsArray[5*i+j]+"\",\"BackColor\",\"backcolor\",\"backcolorpicket\");'>"+
					"<table cellpadding='0' cellspacing='0' border='1' width='12' height='12' bordercolor='#CCCCCC'"+
					" style='background-color:"+colorsArray[5*i+j]+"'>"+
					"<tr><td></td></tr></table></td>";
		}
		str += "</tr>";
	}
	str += "</table></td></tr></table></td></tr></table>";
	var control = document.getElementById('backcolorpicket');
	control.style.display = "block";
	control.innerHTML = str;
}
// 设置对齐方式
function SetAlign(theTD,param,value) {
	editor.focus();
	if (oldClass == 'TextEdit_ButtonNormal')	
		ExecCmd(param,value);
	else
		ExecCmd('justifyleft',null);
}
// 插入符号
function InsertSymbol(name) {
	editor.focus();
	var page = "Subject/specialchar.htm";
	var str = showModalDialog(page,window,"dialogWidth:360px;dialogHeight:280px;status:0;scroll:0;help:0;");
	var range = editor.document.selection.createRange();
	if (str!=null) range.pasteHTML(str);
}
// 插入表情
function InsertEmot(){
	editor.focus();
	var page = "PiscesTextEditor/emot.htm";
	var str = showModalDialog(page,window,"dialogWidth:286px;dialogHeight:202px;status:0;scroll:0;help:0;");
	var range = editor.document.selection.createRange();
	if (str!=null) range.pasteHTML(str);
	editor.focus();
}
// 查找替换
function Replace() {
	editor.focus();
	var page = "Subject/replace.htm";
	showModalDialog(page,window,"dialogWidth:285px;dialogHeight:182px;status:0;scroll:0;help:0;");
}
// 转换为大写字母
function UpperCase() {
	editor.focus();
	var range = editor.document.selection.createRange();
	range.pasteHTML(range.htmlText.toUpperCase());
}
// 转换为小写字母
function LowerCase() {
	editor.focus();
	var range = editor.document.selection.createRange();
	range.pasteHTML(range.htmlText.toLowerCase());
}
// 设置绝对位置
var isAbsolutePosition = false;
function SetAbsolutePosition() {
	editor.focus();
	isAbsolutePosition = !isAbsolutePosition;
	ExecCmd("AbsolutePosition",isAbsolutePosition)
}
// 建立超链接
function CreateLink() {
	editor.focus();
	editor.document.execCommand("createlink","true",null);
}
// 取消超链接
function UnLink() {
	editor.focus();
	editor.document.execCommand("unlink","true",null); 
}
// 插入图片
function InsertPicture() {
	editor.focus();
	var str = showModalDialog("Subject/image.aspx", "", "dialogWidth:438px;dialogHeight:424px;scroll:no;status:0;help:0");
	var range = editor.document.selection.createRange();
	if (str != null) range.pasteHTML(str);
}
// 插入今天日期
function InsertToday() {
	editor.focus();
	var now = new Date();
	var range = editor.document.selection.createRange();
	range.pasteHTML(now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日");
}
// 插入现在时间
function InsertTime() {
	editor.focus();
	var now = new Date();
	var hour = now.getHours().toString();
	hour = (hour.length==1)?("0"+hour):hour;
	var minute = now.getMinutes().toString();
	minute = (minute.length==1)?("0"+minute):minute;
	var second = now.getSeconds().toString();
	second = (second.length==1)?("0"+second):second;
	var range = editor.document.selection.createRange();
	range.pasteHTML(hour+":"+minute+":"+second);
}
// 拼写检查
function IeSpellCheck() {
	try {
		var tspell = new ActiveXObject("ieSpell.ieSpellExtension");
		tspell.CheckAllLinkedDocuments(window.document);
	}
	catch (err){
		if (window.confirm("你确定要安装IE的拼写检查吗?")){
			window.open("http://www.iespell.com/download.php");}
	};
}
// 插入表格
function InsertTable() {
	editor.focus();
	var range = editor.document.selection.createRange();
	var str = showModalDialog("PiscesTextEditor/table.htm", "", "dialogWidth:400px;dialogHeight:350px;scroll:no;status:no;help:no");
	if (str != null) range.pasteHTML(str);
}
// 插入层
function InsertLayer() {
	editor.focus();
	var range = editor.document.selection.createRange();
	var str = "<div style='WIDTH: 104px; POSITION: absolute; HEIGHT: 104px'>在这里输入文字</div>";
	range.pasteHTML(str);
}
// 插入栏目框
function InsertFieldset() {
	editor.focus();
	var str = showModalDialog("PiscesTextEditor/fieldset.htm", "", "dialogWidth:350px;dialogHeight:210px;scroll:no;status:no;help:no;");
	var range = editor.document.selection.createRange();
	if (str != null) range.pasteHTML(str);
}
// 插入网页
function InsertIframe() {
	editor.focus();
	var str = showModalDialog("PiscesTextEditor/iframe.htm", "", "dialogWidth:350px;dialogHeight:245px;scroll:no;status:no;help:no;");  
	var range = editor.document.selection.createRange();
	if (str != null) range.pasteHTML(str);
}
// 插入Flash
function InsertFlash() {
	editor.focus();
	var range = editor.document.selection.createRange();
	var str = showModalDialog("PiscesTextEditor/flash.htm", "", "dialogWidth:320px;dialogHeight:220px;scroll:no;status:no;help:no;"); 
	if (str != null) range.pasteHTML(str);
}
// 插入mediaplayer
function InsertMediaPlayer() {
	editor.focus();
	var str = showModalDialog("PiscesTextEditor/media.htm", "", "dialogWidth:320px; dialogHeight:190px; scroll:no;status:no;help:no;");
	var range = editor.document.selection.createRange();
	if (str != null) range.pasteHTML(str);
}
// 插入realplayer
function InsertRealPlayer() {
	editor.focus();
	var str = showModalDialog("PiscesTextEditor/rm.htm", "", "dialogWidth:320px; dialogHeight:190px; scroll:no;status:0;help:0");  
	var range = editor.document.selection.createRange();
	if (str != null) range.pasteHTML(str);
}
// 插入代码
function InsertCode() {
	editor.focus();
	var str = showModalDialog("PiscesTextEditor/InsertCode.htm",window,"dialogWidth:510px;dialogHeight:400px;status:0;scroll:0;help:0;");
	var range = editor.document.selection.createRange();
	if (str!=null) range.pasteHTML(str);
}
// 帮助
function Help() {
	window.showModalDialog("Subject/help.htm","","dialogWidth:400px;dialogHeight:260px;scroll:no;status:no;help:no");
}

<!-- 工具栏风格 -->
var oldClass = 'TextEdit_ButtonNomal';
function ButtonOver(theTD) {
	oldClass = theTD.className;
	theTD.className = "TextEdit_ButtonOver";
}
function ButtonOut(theTD) {
	document.body.style.cursor = "default";
	theTD.className = oldClass;
}
function ButtonDown(theTD) {
	document.body.style.cursor = "default";
	theTD.className = "TextEdit_ButtonDown";
}
function ButtonSelect(theTD) {
	oldClass = (oldClass == "TextEdit_ButtonDown") ? "TextEdit_ButtonNormal" : "TextEdit_ButtonDown";
	document.body.style.cursor = "default";
	theTD.className = "TextEdit_ButtonDown";
}

<!-- 显示模式菜单 -->
function SetActiveTab(theTD) {
	var parentTR = theTD.parentElement;
	for (var i=0;i<5;i++) {
		if (parentTR.cells[i].className == "TextEdit_TabOn")
			parentTR.cells[i].className = "TextEdit_TabOff";
	}
	theTD.className = "TextEdit_TabOn";
}
function TabOver() { document.body.style.cursor="hand"; }
function TabOut() { document.body.style.cursor="auto"; }
function CheckTag(item,tagName) {
	if (item.tagName.search(tagName)!=-1) {
		return item;
	}
	if (item.tagName=="BODY") {
		return false;
	}
	item=item.parentElement;
	return CheckTag(item,tagName);
}
function CharBefore(sel) {
	if (sel.move("character",-1) == -1) {
		sel.expand("character");
		return sel.text;
	} else {
		return "start";
	}
}
function CharAfter(sel) {
	var sel2 = sel;
	if (sel.expand("character")) {
		sel2.move("character",1);
		sel2.expand("character");
		return sel2.text;
	} else {
		return "end";
	}
}

<!--公共函数-->
// 统计文本框中的总字数
function GetWordCount() {
	totalchars.innerHTML = htmlbox.value.toString().length;
}
function GetClassSubName(className) {
	underscore = className.indexOf("_");
	if (underscore < 0) return className;
	return className.substring(underscore+1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -