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

📄 editor.jsp

📁 IBM RSA下的JSF开发示例
💻 JSP
📖 第 1 页 / 共 3 页
字号:
		for(var j = 1; j <= 7; j++)		{			var h = IBM_RTE_getDocument(editorName).body.getElementsByTagName("h"+j);			var i = 0;			while(h[i]){				var bodyRange = IBM_RTE_getDocument(editorName).createRange();				var inRange = false;				paraRange = bodyRange;				paraRange.setStartBefore(h[i]);				paraRange.setEndAfter(h[i]);				var START_TO_START = 0;				var END_TO_START = 3;				if(paraRange.compareBoundaryPoints(START_TO_START,rng) >= 0){					if(paraRange.compareBoundaryPoints(END_TO_START,rng) <= 0)						inRange = true;				}				else if(rng.compareBoundaryPoints(END_TO_START,paraRange) <= 0)						inRange = true;				if(inRange){					h[i].innerHTML = "odcH"+j+h[i].innerHTML;				}				i++;			}		}		IBM_RTE_getDocument(editorName).execCommand("formatblock", false, "P");		var par = IBM_RTE_getDocument(editorName).body.getElementsByTagName("P");		var pi = 0;		var index;		while(par[pi]){			if((index = par[pi].innerHTML.indexOf("odcH"))!= -1)			{				var hNo = par[pi].innerHTML.charAt(index+4);				var node = IBM_RTE_getDocument(editorName).createElement("h"+hNo);				var newNode = par[pi].parentNode.insertBefore(node,par[pi]);				var iHTML = par[pi].innerHTML.substring(index+5);				par[pi].parentNode.removeChild(par[pi]);				newNode.innerHTML = iHTML;			}			pi++;		}		for(var j = 1; j <= 7; j++){			var h = IBM_RTE_getDocument(editorName).body.getElementsByTagName("h"+j);			var i = 0;			while(h[i]){				if(h[i].innerHTML.indexOf("odcH")!= -1){					h[i].innerHTML = h[i].innerHTML.substring(5);;				}				i++;			}		}		//For Setting Pararaph Line Spacing to single		var ps = IBM_RTE_getDocument(editorName).body.getElementsByTagName("P");		var psi = 0;			while(ps[psi] != null){					if(ps[psi].style.marginTop == ""){					ps[psi].style.marginBottom = "10px";					ps[psi].style.marginTop = "10px";					if(ps[psi].style.margin=="")						ps[psi].style.margin = "0px";					if(ps[psi].style.LineHeight=="")						ps[psi].style.LineHeight = "normal";				}								psi++;			}//End Of While}function IBM_RTE_IE_addPTags(editorName){	var elem = document.getElementById("<%= editorName %>ToolbarFormatButtonSourceCodeImg");	if(elem != null && elem.title != "Design Mode")	{		var ps = IBM_RTE_getDocument("<%= editorName %>").body.getElementsByTagName("P");		if(ps.length == 0){			var bodyRange = IBM_RTE_getDocument("<%= editorName %>").body.createTextRange();			if(bodyRange.text != ""){				<%-- Header Fix IE--%>				var rng = IBM_RTE_getSelectionRange("<%= editorName %>");				var parNode = rng.parentElement();				var nodeName = parNode.tagName;				if(!(nodeName == "H1" || nodeName == "H2" || nodeName == "H3" || nodeName == "H4" || nodeName == "H5" || nodeName == "H6")) <%-- Header Fix IE--%>				{					IBM_RTE_getDocument("<%= editorName %>").execCommand("formatblock", false, "<p>");					ps = IBM_RTE_getDocument("<%= editorName %>").body.getElementsByTagName("P");				}				}		}		var psi = 0;		while(ps[psi] != null){				if(ps[psi].style.marginTop == ""){				ps[psi].style.marginBottom = "1px";				ps[psi].style.marginTop = "1px";				if(ps[psi].style.margin=="")					ps[psi].style.margin = "0px";				//Condition to avoid double coming of the same attribute				if(ps[psi].style.LineHeight=="")					ps[psi].style.LineHeight = "normal";			}			psi++;		}//End Of While	}}function IBM_RTE_isCustomTag(str){	var match = new String(str);	str1 = "href="+"<%= apostrophe%>"+"\"";	str2 = "src="+"<%= apostrophe%>"+"\"";	str3 = "href=&quot;\"";	str4 = "src=&quot;\"";	str5 = "href=\"\"";	str6 = "src=\"\"";	if(match.indexOf(str1) == -1)		if(match.indexOf(str2) == -1)			if(match.indexOf(str3) == -1)				if(match.indexOf(str4) == -1)					if(match.indexOf(str5) == -1)						if(match.indexOf(str6) == -1)							return false;	return true;}function IBM_RTE_setMode(editorName, mode){   IBM_RTE_getDocument(editorName).mode = mode;}function IBM_RTE_getFormat(editorName){	var selRange = IBM_RTE_getSelectionRange(editorName);if(selRange == null )return null; if(selRange.text == null)return null;	if(!IBM_RTE_isMozilla()){		var node = selRange.parentElement();		while(node.tagName != "BODY"){			if(node.tagName.length == 2 && node.tagName.charAt(0) == "H" && (node.tagName.charAt(1) == 1 || node.tagName.charAt(1) == 2 || node.tagName.charAt(1) == 3 || node.tagName.charAt(1) == 4 || node.tagName.charAt(1) == 5 || node.tagName.charAt(1) == 6)){//H[1-6]				return "<" + node.tagName + ">";			}else{				node = node.parentElement;			}		}		return null;	}else{		var node = selRange.startContainer;		node      = node.parentNode;		while(node.nodeName != "BODY"){			if(node.nodeName.length == 2 && node.nodeName.charAt(0) == "H" && (node.nodeName.charAt(1) == 1 || node.nodeName.charAt(1) == 2 || node.nodeName.charAt(1) == 3 || node.nodeName.charAt(1) == 4 || node.nodeName.charAt(1) == 5 || node.nodeName.charAt(1) == 6)){//H[1-6]				return "<" + node.nodeName + ">";			}else{				node = node.parentNode;			}		}	return null;	}}function IBM_RTE_getFontSize(editorName){	var selRange = IBM_RTE_getSelectionRange(editorName);if(selRange == null)return null; if(selRange.text == null)return null;	if(!IBM_RTE_isMozilla()){		return 	selRange.queryCommandValue("FontSize");	}else{		var startNode = selRange.startContainer;		var endNode = selRange.endContainer;		if(startNode != endNode){			return checkOverlap(selRange, editorName, 0); // size --> 0		}		var node = startNode.parentNode;		while(node.nodeName != "BODY"){			if(node.nodeName == "FONT"){				return node.getAttribute("size");			}else{				node = node.parentNode;			}		}		return null;	}}function IBM_RTE_getFontFace(editorName){	var selRange = IBM_RTE_getSelectionRange(editorName);if(selRange == null)return null; if(selRange.text == null)return null;	if(!IBM_RTE_isMozilla()){		return selRange.queryCommandValue("FontName");	}	else{		var startNode = selRange.startContainer;		var endNode = selRange.endContainer;		if(startNode != endNode){			return checkOverlap(selRange, editorName, 1); // face --> 1		}else{			var node = startNode.parentNode;			while(node.nodeName != "BODY"){				if(node.nodeName == "SPAN"){					if(node.style.fontFamily != "" && node.style.fontFamily != null){							return node.style.fontFamily;					}				}				if(node.nodeName == "P"){					if(node.style.fontFamily != "" && node.style.fontFamily != null){							return node.style.fontFamily;					}				}				node = node.parentNode;			}			return null;		}	}}function IBM_RTE_modFormatList(flag){	if(flag == false){		var formatInfo =  IBM_RTE_getFormat("<%= editorName %>");		var node = this.document.getElementById("<%= editorName %>" + "ToolbarFormatListFontFormat");		var kids = node.childNodes;			if(kids.length == (IBM_RTE_isMozilla()==true)?3:1 ) {// div block			var kidsofkids = kids[(IBM_RTE_isMozilla()==true)?1:0].childNodes;			if(kidsofkids.length == 1){				var selectNode = kidsofkids[0];				if(formatInfo != null || formatInfo == ""){					optionSelected = "Heading " + formatInfo.charAt(2);					for(var i=0; i<selectNode.options.length; i++)						if(selectNode.options[i].text == optionSelected){							selectNode.options.selectedIndex = i;									return;					}				}else{					for(var j=0; j<selectNode.options.length; j++)						if(selectNode.options[j].text == "Normal"){							selectNode.options.selectedIndex = 1;								return;					}				}			}		}	}}function IBM_RTE_modFontSizeList(flag){	if(flag == true) return; 	var fontSizes = new Array("7pt", "9pt", "12pt", "14pt", "18pt", "24pt");	var fontSizeInfo =  IBM_RTE_getFontSize("<%= editorName %>");	var pt;	var node = this.document.getElementById("<%= editorName %>" + "ToolbarFormatListFontSize");	var kids = node.childNodes;	if(kids.length == (IBM_RTE_isMozilla()==true)?3:1) {// div block		var kidsofkids = kids[(IBM_RTE_isMozilla()==true)?1:0].childNodes;		if(kidsofkids.length == 1){			var selectNode = kidsofkids[0];						if(fontSizeInfo == "notnull" || (!IBM_RTE_isMozilla() && fontSizeInfo == null)){				selectNode.options[0] = new Option("--Size--", "", false, true);				return;			}			if(fontSizeInfo != null && fontSizeInfo != ""){				if(fontSizeInfo > 0 && fontSizeInfo < 7){					pt = fontSizes[fontSizeInfo - 1];				}else{					fontSizeInfo = 3;					pt = "12pt";				}				for(i=0; i<selectNode.options.length; i++){								if(selectNode.options[i].text == pt){						selectNode.options.selectedIndex = i;						return;					}				}			}			if(!IBM_RTE_isMozilla())				selectNode.options[0] = new Option("12pt", "3", true, true);			if(IBM_RTE_isMozilla())				selectNode.options.selectedIndex = 3;		}	}}function IBM_RTE_modFontFaceList(flag){	if(flag == true) return;	var fontFaces = new Array("Arial", "Bookman", "Courier", "Garamond", "Lucida Console", "Symbol", "Tahoma", "Times", "Trebuchet", "Verdana");	var altFontFaces = new Array("arial,helvetica,sans-serif", "bookman old style,new york,times,serif","courier,monaco,monospace,sans-serif","garamond,new york,times,serif", "lucida console,sans-serif", "symbol,fantasy", "tahoma,new york,times,serif", "times new roman,new york,times,serif", "trebuchet ms,helvetica,sans-serif", "verdana,helvetica,sans-serif");	var altAltFontFaces = new Array("Arial", "Bookman Old Style", "Courier", "Garamond", "Lucida Console", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana");		var fontFaceInfo =  IBM_RTE_getFontFace("<%= editorName %>");		if(fontFaceInfo != null){		fontFaceInfo = fontFaceInfo.replace(/,[ ]*/gi, ",");	}	var face;	var node = this.document.getElementById("<%= editorName %>" + "ToolbarFormatListFontStyle");	var kids = node.childNodes;	if(kids.length == (IBM_RTE_isMozilla()==true)?3:1){// div block		var kidsofkids = kids[(IBM_RTE_isMozilla()==true)?1:0].childNodes;		if(kidsofkids.length == 1){			var selectNode = kidsofkids[0];			if(fontFaceInfo == "notnull" || (!IBM_RTE_isMozilla() && fontFaceInfo == null)){				selectNode.options[0] = new Option("--Font--", "", false, true);				return;			}						if(fontFaceInfo != null && fontFaceInfo != ""){				for(var xxx = 0; xxx < fontFaces.length; xxx++){					if(fontFaceInfo.toLowerCase() == fontFaces[xxx].toLowerCase() || 						fontFaceInfo.toLowerCase() == altFontFaces[xxx].toLowerCase() ||						fontFaceInfo.toLowerCase() == altAltFontFaces[xxx].toLowerCase()){						fontFaceInfo = altFontFaces[xxx];						face = fontFaces[xxx];						break;					}				}								for(i=0; i<selectNode.options.length; i++){					if(selectNode.options[i].text == face){						selectNode.selectedIndex = i;						return;					}				}			}			if(!IBM_RTE_isMozilla())				selectNode.options[0] = new Option("Times", "times new roman,new york,times,serif", true, true);			else{ //if fontFaceInfo == null or if it is set to times				if(fontFaceInfo == null)					selectNode.options.selectedIndex = 8;			}		}	}}// defect 147838 end//control character fixfunction stripControlCharacters(content){		var xxx = 0;		while(xxx < renderedCtrlChars.length){			while(content.indexOf(renderedCtrlChars[xxx]) != -1){				content = content.replace(renderedCtrlChars[xxx], "");			}			xxx++		}	return content;}//control character fix</script>

⌨️ 快捷键说明

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