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

📄 table.html

📁 程序设计:Flyangel 用到了vb.net c# asp.net xml等 最大特别是核心功能组件化. 特色: 强大的后台管理功能 支持二级分类 支持匿名投稿 超强用户权限设置
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html>
	
<head>
<title>表格生成器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
	<script language="javascript">
	
	function IsPosInt(sInput)
		{
		if(sInput=="") return true;
		var sTmp = sInput.toString();
		for(var i=0;i<sTmp.length;i++)
			{
			var sChar = sTmp.charAt(i);
			if(sChar<"0"||sChar>"9") return false;
			}
		
		return true;
		}

	function IsPosIntNotZero(sInput)
		{
		if(sInput=="") return true;
		var sTmp = sInput.toString();
		for(var i=0;i<sTmp.length;i++)
			{
			var sChar = sTmp.charAt(i);
			if(sChar<"0"||sChar>"9") return false;
			}
		if(sInput*1==0) {return false}
		else {return true};
		}
		
		
	function TableInsert()
		{
		window.close();
		
		if(!(IsPosIntNotZero(NewTable.Rows.value) &&
			IsPosIntNotZero(NewTable.Columns.value) &&
			IsPosIntNotZero(NewTable.Width.value) &&
			IsPosIntNotZero(NewTable.Height.value) &&
			IsPosInt(NewTable.Border.value) &&
			IsPosInt(NewTable.Cellpadding.value) &&
			IsPosInt(NewTable.Cellspacing.value)
			)) 
			{
			alert("无效的输入!");
			return false;
			}
				
		var sHTML = ""
			+ "<TABLE "
			+ (((NewTable.Border.value=="") || (NewTable.Border.value=="0")) ? "class=\"NOBORDER\"" : "")
			//+	(NewTable.inpTblAlign.value != "" ? "align=\"" + NewTable.inpTblAlign.value + "\" " : "")		
			+	(NewTable.Width.value != "" ? "width=\"" + NewTable.Width.value + NewTable.WidthUnit.value + "\" " : "")
			+	(NewTable.Height.value != "" ? "height=\"" + NewTable.Height.value + NewTable.HeightUnit.value + "\" " : "")		
			+	(NewTable.Cellpadding.value != "" ? "cellPadding=\"" + NewTable.Cellpadding.value + "\" " : "")
			+	(NewTable.Cellspacing.value != "" ? "cellSpacing=\"" + NewTable.Cellspacing.value + "\" " : "")
			+	(NewTable.Border.value != "" ? "border=\"" + NewTable.Border.value + "\" " : "")
			+	(NewTable.BorderColor.value != "" ? "bordercolor=\"" + NewTable.BorderColor.value + "\" " : "")
			//+	(NewTable.inpBgImage.value != "" ? "background=\"" + NewTable.inpBgImage.value + "\" " : "")
			//+	(NewTable.inpBgColor.value != "" ? "bgColor=\"" + NewTable.inpBgColor.value + "\" " : "")
			+ ">"
		for (var i=0; i < NewTable.Rows.value; i++) 
			{
			sHTML += "<TR>"
			for (var j=0; j < NewTable.Columns.value; j++)
			sHTML += "<TD>&nbsp;</TD>"
			sHTML += "</TR>"
			}
		sHTML += "</TABLE>"
		
		window.opener.InsertTable(sHTML);
		
		
		}

	function TableUpdate()
		{
				
				window.close();	
				
				if(!(IsPosIntNotZero(EditTable.Width.value) &&
					IsPosIntNotZero(EditTable.Height.value) &&
					IsPosInt(EditTable.Cellpadding.value) &&
					IsPosInt(EditTable.Cellspacing.value) &&
					IsPosInt(EditTable.Border.value))) 
					{
					alert("无效的输入!");
					return false;
					}
					
			var oSel = window.opener.HTMLEditor.document.selection.createRange()
			var sType = window.opener.HTMLEditor.document.selection.type		
						
					var oBlock = (oSel.parentElement != null ? GetElement(oSel.parentElement(),"TABLE") : GetElement(oSel.item(0),"TABLE"))
					if (oBlock!=null) 
						{
						//oBlock.align = EditTable.inpTblAlign2.value
						if(EditTable.Width.value!="")
							{
							oBlock.style.width=""; //remove style width
							oBlock.width = EditTable.Width.value + EditTable.WidthUnit.value;
							}
						else
							{
							oBlock.width = ""
							}
						if(EditTable.Height.value!="")
							{
							oBlock.style.height=""; //remove style height
							oBlock.height = EditTable.Height.value + EditTable.HeightUnit.value;
							}
						else
							{
							oBlock.height = ""
							}		
						oBlock.cellPadding = EditTable.Cellpadding.value
						oBlock.cellSpacing = EditTable.Cellspacing.value
						oBlock.border = EditTable.Border.value
						oBlock.borderColor = EditTable.BorderColor.value
					
						}
		}		
		
		
	function UpdateCell()
		{
				window.close();
		
				if(!(IsPosIntNotZero(EditCell.Width.value) &&
					IsPosIntNotZero(EditCell.Height.value))) 
					{
					alert("无效的输入!");
					return false;
					}
			
			var oSel = window.opener.HTMLEditor.document.selection.createRange()
			var sType = window.opener.HTMLEditor.document.selection.type		
							
				var oTD = (oSel.parentElement != null ? GetElement(oSel.parentElement(),"TD") : GetElement(oSel.item(0),"TD"))
				if (oTD!=null)
					{
					if(EditCell.Width.value!="")
						{
						oTD.style.width=""; //remove style width 
						oTD.width = EditCell.Width.value + EditCell.WidthUnit.value;
						}
					else
						{
						oTD.width = ""
						}
					if(EditCell.Height.value!="")
						{
						oTD.style.height=""; //remove style height
						oTD.height = EditCell.Height.value + EditCell.HeightUnit.value;
						}
					else
						{
						oTD.height = ""
						}		
					
					oTD.align = EditCell.Align.value ;
					oTD.vAlign = EditCell.Valign.value;					
					oTD.bgColor = EditCell.BgColor.value;
					oTD.noWrap = !(EditCell.WrapText.checked);
					}
		}
		
		
// TAB MANAGEMENT 
		
		function TabInsertTable()
			{
			//window.divBorderColorPick.style.display = "none";
			//window.divBgColorPick.style.display = "none";	
				
			window.divNewTable.style.display="block";
			window.divEditTable.style.display="none";
			window.divEditCell.style.display="none";
		
			window.tab1.style.cursor = "";
			window.tab1.style.background = "#ececec";
			window.tab1.style.color = "darkslateblue";
			window.tab1.style.borderBottom = "";
			window.tab1.innerHTML = "<b>创建表格</b>"
		
			window.tab2.style.background = "#bebebe";
			window.tab2.style.color = "darkslateblue";
			window.tab2.style.borderBottom = "darkgray 1px solid";
			window.tab2.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabEditTable()'><b><u>编辑表格</u></b></div>"
			
			window.tab3.style.background = "#bebebe";
			window.tab3.style.color = "darkslateblue";
			window.tab3.style.borderBottom = "darkgray 1px solid";
			window.tab3.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabEditCell()'><b><u>编辑单元格</u></b></div>"
			
			}
			
		function TabEditTable()
		{	
			//window.divBorderColor2Pick.style.display = "none";
			//window.divBgColor2Pick.style.display = "none";	
				
			window.divNewTable.style.display="none";
			window.divEditTable.style.display="block";
			window.divEditCell.style.display="none";
		
			window.tab1.style.background = "#bebebe";
			window.tab1.style.color = "darkslateblue";
			window.tab1.style.borderBottom = "darkgray 1px solid";
			window.tab1.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabInsertTable()'><b><u>创建表格</u></b></div>"
		
			window.tab2.style.cursor = "";
			window.tab2.style.background = "#ececec";
			window.tab2.style.color = "darkslateblue";
			window.tab2.style.borderBottom = "";
			window.tab2.innerHTML = "<b>编辑表格</b>"
			
			window.tab3.style.background = "#bebebe";
			window.tab3.style.color = "darkslateblue";
			window.tab3.style.borderBottom = "darkgray 1px solid";
			window.tab3.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabEditCell()'><b><u>编辑单元格</u></b></div>"
			
		}
		
		function TabEditCell()
			{
			
			window.divNewTable.style.display="none";
			window.divEditTable.style.display="none";
			window.divEditCell.style.display="block";
			
			window.tab1.style.background = "#bebebe";
			window.tab1.style.color = "darkslateblue";
			window.tab1.style.borderBottom = "darkgray 1px solid";
			window.tab1.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabInsertTable()'><b><u>创建表格</u></b></div>"
			
			window.tab2.style.background = "#bebebe";
			window.tab2.style.color = "darkslateblue";
			window.tab2.style.borderBottom = "darkgray 1px solid";
			window.tab2.innerHTML = "<div style='cursor:hand;width=100%;' onclick='parent.TabEditTable()'><b><u>编辑表格</u></b></div>"
			
			window.tab3.style.cursor = "";
			window.tab3.style.background = "#ececec";
			window.tab3.style.color = "darkslateblue";
			window.tab3.style.borderBottom = "";
			window.tab3.innerHTML = "<b>编辑单元格</b>"	
			
			//when the control (table) is selected, the focus shouldn't be displayed. 
			//Then set the focus to another control.
			//inpCellBgColor.focus()	
			}
		
		
		function EnableEditTableOnly()
		{
			window.tab1.style.cursor = "";
			window.tab1.style.background = "#bebebe";
			window.tab1.style.color = "darkgray";
			window.tab1.style.borderBottom = "";
			window.tab1.innerHTML = "<b><u>创建表格</u></b>"
		
			window.tab3.style.cursor = "";
			window.tab3.style.background = "#bebebe";
			window.tab3.style.color = "darkgray";
			window.tab3.style.borderBottom = "";
			window.tab3.innerHTML = "<b><u>编辑单元格</u></b>"
			}
			
			
		function DisableEditTable()
		{
		
			window.tab2.style.cursor = "";
			window.tab2.style.background = "#bebebe";
			window.tab2.style.color = "darkgray";
			window.tab2.style.borderBottom = "";
			window.tab2.innerHTML = "<b><u>编辑表格</u></b>"
		
			window.tab3.style.cursor = "";
			window.tab3.style.background = "#bebebe";
			window.tab3.style.color = "darkgray";
			window.tab3.style.borderBottom = "";

⌨️ 快捷键说明

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