实例介绍
【实例简介】
【实例截图】
【核心代码】
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; using System.Web.Security; using System.Globalization; using System.Text.RegularExpressions; using System.Text; using System.Security.Cryptography; using System.IO; namespace Teach_C { public partial class Default : System.Web.UI.Page { TextBox input_name; TextBox input_pasw; Button m_button = new Button(); string sname, loginfo; protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); //很重要,不加这句,就需开启浏览器的不用缓存功能,否则不显示会话 loginfo = ""; //判断是否登陆了 try { loginfo = Session["user"].ToString(); } catch { loginfo = ""; } //框架 Table Table_Frame; Table_Frame = new Table(); //建立表格 Table_Frame.HorizontalAlign = HorizontalAlign.Center; //表格内内容居中 Table_Frame.Width = 900; //宽度 Table_Frame.CellPadding = 0; //边框 Table_Frame.CellSpacing = 0; //边框 TableRow Table_FrameRow = new TableRow(); //表格内建立一行 TableCell Table_FrameCell = new TableCell(); //表格内建立一列 //页面内容 Table Page_Table = new Table();//建立表格 Page_Table.BackImageUrl = "images/albk.gif"; Page_Table.Width = 900; //宽度 Page_Table.CellSpacing = 0; //边框 Page_Table.CellPadding = 0; //边框 TableRow Page_Row = new TableRow();//表格内建立一行 Page_Row.Height = 300; //行的高度 TableCell Page_Cell = new TableCell();//表格内建立一列 Page_Cell.HorizontalAlign = HorizontalAlign.Center;//居中 Page_Cell.VerticalAlign = VerticalAlign.Top; //居顶 Table j_Table = new Table(); j_Table.CellPadding = 0; j_Table.CellSpacing = 0; j_Table.Width = 800;// Unit.Percentage(100); TableRow j_Row = new TableRow(); TableCell j_Cell = new TableCell(); //顶部logo Table top_Table = new Table(); top_Table.CellPadding = 0; top_Table.CellSpacing = 0; top_Table.Width = 800; top_Table.Height = 135; top_Table.BackImageUrl = "images/top.gif"; //登录框 TableRow top_Row = new TableRow(); TableCell top_Cell = new TableCell(); top_Cell.Width = 590; top_Row.Cells.Add(top_Cell); top_Cell = new TableCell(); top_Cell.Width = 210; //登录输入 Table log_Table = new Table(); log_Table.Width = 210; log_Table.Height = 135; log_Table.CellPadding = 0; log_Table.CellSpacing = 0; if (loginfo == "") //没登录的话,输用户名和密码 { TableRow log_row = new TableRow(); log_row.Height = 45; TableCell log_cell = new TableCell(); log_cell.Width = 30; log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_cell.Width = 101; log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_cell.Width = 10; log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_cell.Width = 41; log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_cell.Width = 28; log_row.Cells.Add(log_cell); log_Table.Rows.Add(log_row); log_row = new TableRow(); log_cell = new TableCell(); log_row.Height = 15; log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); //输入名字 input_name = new TextBox(); input_name.Width = 99; input_name.Height = 14; input_name.CssClass = "inputbox_no"; input_name.MaxLength = 12; log_cell.Controls.Add(input_name); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_cell.RowSpan = 2; //登录按钮 log_cell.Text = "<img src='images/log_btn.gif' style='CURSOR:pointer;' onclick='document.getElementById(\"name_load\").click();'>"; log_row.Cells.Add(log_cell); log_cell = new TableCell(); m_button.Style.Add("display", "none"); m_button.ID = "name_load"; m_button.Click = new System.EventHandler(Button1_Click); log_cell.Controls.Add(m_button); log_row.Cells.Add(log_cell); log_Table.Rows.Add(log_row); log_row = new TableRow(); log_cell = new TableCell(); log_row.Height = 15; log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); input_pasw = new TextBox(); input_pasw.Width = 99; input_pasw.Height = 14; input_pasw.CssClass = "inputbox_no"; input_pasw.TextMode = TextBoxMode.Password;//密码 input_pasw.MaxLength = 6; log_cell.Controls.Add(input_pasw); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_Table.Rows.Add(log_row); log_row = new TableRow(); log_cell = new TableCell(); log_row.Height = 60; log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_cell = new TableCell(); log_row.Cells.Add(log_cell); log_Table.Rows.Add(log_row); } else //登陆了,显示当前用户 { log_Table.BackImageUrl = "images/lgb.gif"; TableRow log_row = new TableRow(); log_row.Width = 210; log_row.Height = 146; TableCell log_cell = new TableCell(); string userIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userIP == null || userIP == "") { userIP = Request.ServerVariables["REMOTE_ADDR"]; } log_cell.Text = "<div style='font-family:微软雅黑,宋体;font-size:1em;color:#969696;'>" "<div style='width:100%;text-align:left'>当前用户:" loginfo "</div>" "<div style='width:100%;height:5px;'></div>" "<div style='width:100%;text-align:left'>登录时间:" DateTime.Now.ToLocalTime().ToString() "</div>" "<div style='width:100%;height:5px;'></div>" "<div style='width:100%;text-align:left'>登录地址:" userIP "</div>" "</div>"; log_row.Cells.Add(log_cell); log_Table.Rows.Add(log_row); this.ClientScript.RegisterStartupScript(this.GetType(), "scriptKey", "InitUser('" loginfo "');", true); //初始化用户 } top_Cell.Controls.Add(log_Table); top_Row.Cells.Add(top_Cell); top_Table.Rows.Add(top_Row); j_Cell.Controls.Add(top_Table); j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); j_Row = new TableRow(); j_Cell = new TableCell(); Table mid_Table = new Table(); mid_Table.CellPadding = 0; mid_Table.CellSpacing = 0; mid_Table.BackColor = System.Drawing.Color.White; mid_Table.Width = 800; mid_Table.Height = 350; TableRow mid_row = new TableRow(); mid_row.Height = 10; TableCell mid_cell = new TableCell(); mid_cell.ColumnSpan = 3; mid_row.Cells.Add(mid_cell); mid_Table.Rows.Add(mid_row); mid_row = new TableRow(); mid_row.Height = 330; mid_cell = new TableCell(); mid_cell.Width = 30; mid_cell.Text = "<div id='sel_tmp' style='width:0px;height:0px;display:none'></div>";//选中的文字内容,隐藏的 mid_row.Cells.Add(mid_cell); mid_cell = new TableCell(); mid_cell.Width = 740; mid_cell.Text = //显示会话内容 "<div id='txtShow' style='height:320px; width:100%;overflow-y:scroll;overflow-x:hidden;OVERFLOW:auto;margin-top:0px;background:#fff;word-break:break-all;text-align:left'></div>"; mid_row.Cells.Add(mid_cell); mid_cell = new TableCell(); mid_cell.Width = 30; mid_cell.Text = "<input type='hidden' id='id_tmp'>";//选中的文字内容的id,隐藏的 mid_row.Cells.Add(mid_cell); mid_Table.Rows.Add(mid_row); mid_row = new TableRow(); mid_row.Height = 10; mid_cell = new TableCell(); mid_cell.ColumnSpan = 3; mid_row.Cells.Add(mid_cell); mid_Table.Rows.Add(mid_row); j_Cell.Controls.Add(mid_Table); j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); j_Row = new TableRow(); j_Cell = new TableCell(); word_edit(j_Cell);//编辑器控制按钮及功能 j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); j_Row = new TableRow(); j_Cell = new TableCell(); Table wid_Table = new Table(); wid_Table.BackColor = System.Drawing.Color.White; TableRow wid_row = new TableRow(); TableCell wid_cell = new TableCell(); wid_Table.CellPadding = 0; wid_Table.CellSpacing = 0; wid_Table.Width = 800; wid_Table.Height = 150; wid_row.Height = 5; wid_cell.ColumnSpan = 3; wid_row.Cells.Add(wid_cell); wid_Table.Rows.Add(wid_row); wid_row = new TableRow(); wid_row.Height = 145; wid_cell = new TableCell(); wid_cell.Width = 30; wid_row.Cells.Add(wid_cell); wid_cell = new TableCell(); wid_cell.Width = 740; if (loginfo == "") //编辑框 { wid_cell.Text = "<div id='abcEdit_mid'>请先输入用户名登录。用户名为任意6个字符,密码没有或任意输入。</div>"; } else { wid_cell.Text = "<div id='abcEdit_mid' contentEditable=true onclick='set_Selstat(false)'></div>"; } wid_row.Cells.Add(wid_cell); wid_cell = new TableCell(); wid_cell.Width = 30; wid_row.Cells.Add(wid_cell); wid_Table.Rows.Add(wid_row); j_Cell.Controls.Add(wid_Table); j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); j_Row = new TableRow(); j_Row.Height = 40; j_Row.VerticalAlign = VerticalAlign.Bottom; j_Row.HorizontalAlign = HorizontalAlign.Center; j_Cell = new TableCell(); if (loginfo != "") //发送会话按钮 { j_Cell.Text = @"<img id='sendMsg' name='sendMsg' src='images/send.png' onclick='sendMessage(document.getElementById(""abcEdit_mid"").innerHTML);execHTML(""SelectAll"");execHTML(""Delete"");' style='cursor:pointer'>"; } j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); //底部信息 j_Row = new TableRow(); j_Cell = new TableCell(); Table cpr_Table = new Table(); cpr_Table.CellPadding = 0; cpr_Table.CellSpacing = 0; cpr_Table.BackImageUrl = "images/cpyr.gif"; cpr_Table.Width = 800; cpr_Table.Height = 90; j_Cell.Controls.Add(cpr_Table); j_Row.Cells.Add(j_Cell); j_Table.Rows.Add(j_Row); Page_Cell.Controls.Add(j_Table); //装入表格 Page_Row.Cells.Add(Page_Cell); //将列装入行 Page_Table.Rows.Add(Page_Row); //将行装入表格 //////////////////////////////////////////////////////////////////////// Table_FrameCell.Controls.Add(Page_Table); //将表格 Page_Table 装入 Table_Frame的列 Table_FrameRow.Cells.Add(Table_FrameCell);//将列装入行 Table_Frame.Rows.Add(Table_FrameRow);//将行装入表格 //这里是页面Default.aspx文件定义的那个空表 table_fence ,建立行,并装入表格 Table_Frame,这里的行列是不一样的 System.Web.UI.HtmlControls.HtmlTableRow HtmlTableRow = new System.Web.UI.HtmlControls.HtmlTableRow(); //建立行 System.Web.UI.HtmlControls.HtmlTableCell HtmlCell = new System.Web.UI.HtmlControls.HtmlTableCell(); //建立列 HtmlCell.Controls.Add(Table_Frame); //装入表格 Table_Frame HtmlTableRow.Controls.Add(HtmlCell);//将列装入行 table_fence.Rows.Add(HtmlTableRow);//将行装入表格 GC.Collect(); //释放资源 } protected void interval(TableCell n_cell, int wd, TableRow m_row) //列间隔控制,列名,宽度,所在行名 { n_cell = new TableCell(); n_cell.Width = wd; m_row.Cells.Add(n_cell); } protected void Button1_Click(object sender, System.EventArgs e) //点击登录按钮时间 { if (loginfo == "") { Session["user"] = input_name.Text; sname = Session["user"].ToString(); this.ClientScript.RegisterStartupScript(this.GetType(), "scriptKey", "InitUser('" sname "');", true);//初始化会话信息 Response.Redirect(Request.Url.ToString()); //刷新页面 } } protected void word_edit(TableCell main_cell) { string s_loop; //编辑器按钮 Table edt_Table = new Table(); edt_Table.CellPadding = 0; edt_Table.CellSpacing = 0; edt_Table.BackImageUrl = "images/edbtn.gif"; edt_Table.Width = 800; edt_Table.Height = 33; TableRow edt_row = new TableRow(); edt_row.Height = 5; TableCell edt_cell = new TableCell(); edt_row.Cells.Add(edt_cell); edt_Table.Rows.Add(edt_row); edt_row = new TableRow(); edt_row.Height = 23; edt_cell = new TableCell(); edt_cell.Width = 30; edt_row.Cells.Add(edt_cell); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //1. 插入表情 edt_cell.Width = 29; s_loop = ""; for (int ie = 0; ie < 3; ie ) { for (int t = 0; t < 10; t ) { s_loop = s_loop "<div style='position:absolute;left:" ((t 1) * 58) "px;margin:" ie*40 "px auto auto auto' onmouseover='abcEdit_mid.focus();'>"; s_loop = s_loop "<img onclick='insert_HTML(\"<img src=images/editcom/" ((t 1) ie * 10) ".gif>\"); " "setDisplay(\"tips1\",false);' " "style='cursor:pointer' id=smilie_" t " src=images/editcom/" ((t 1) ie*10) ".gif></div>"; } s_loop = s_loop "<br>"; } s_loop = "<div style='width:580px;height:165px;position:absolute;margin:10px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div style='width:30px;height:23px;border:none;' onmouseover='setDisplay(""tips1"",true);'></div> <span id='tips1' class='custom info transparent' style=' width:580px;height:190px;cursor:default;'> <img src='images/info.png' height='48' width='48'> <em>[ 插入表情 ] -- 点击图片,将图片插入到输入的文字中当前光标位置。</em>" s_loop @"</span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 13, edt_row); //间隔,下同 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //2. 全部删除 edt_cell.Width = 15; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips2"",true);' onmouseout='setDisplay(""tips2"",false);' style='width:15px;height:23px;border:none;' onclick='setDisplay(""tips2"",false); execHTML(""Delete"");'> </div> <span id='tips2' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 删除文字 ] -- 删除选中的文字内容。<br>      可按“Ctrl A”选择全部内容,按此按钮全部清除。<br>       可使用鼠标选中部分文字,按此按钮清除选中的文字内容。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 16, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //3. 撤销 edt_cell.Width = 16; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips3"",true);' onmouseout='setDisplay(""tips3"",false);' style='width:16px;height:23px;border:none;' onclick='setDisplay(""tips3"",false); execHTML(""Undo"");'> </div> <span id='tips3' class='custom info transparent' style=' width:220px;height:65px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 撤销操作 ] -- 返回当前结果前面状态。<br>       保留最近执行的操作记录,可以按照从后到前的顺序撤销若干步骤,但不能有选择地撤销不连续的操作。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 8, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //4. 恢复 edt_cell.Width = 16; //edt_cell.BackColor = System.Drawing.Color.BlueViolet; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips4"",true);' onmouseout='setDisplay(""tips4"",false);' style='width:16px;height:23px;border:none;' onclick='setDisplay(""tips4"",false); execHTML(""Redo"");'> </div> <span id='tips4' class='custom info transparent' style=' width:220px;height:50px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 重复操作 ] -- 重复最后编辑操作。<br>       重复输入文本、设置格式或重复插入图片、符号等操作。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 17, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //5. 复制 edt_cell.Width = 18; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips5"",true);' onmouseout='setDisplay(""tips5"",false);' style='width:18px;height:23px;border:none;' onclick='setDisplay(""tips5"",false); execHTML(""Copy"");'> </div> <span id='tips5' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 复制内容 ] -- 复制选中的文字内容。<br>       可按“Ctrl A”选择全部内容,按此按钮全部复制。<br>       可使用鼠标选中部分文字,按此按钮复制选中的文字内容。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //6. 粘贴 edt_cell.Width = 18; //edt_cell.BackColor = System.Drawing.Color.BlueViolet; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips6"",true)'; onmouseout='setDisplay(""tips6"",false);' style='width:18px;height:23px;border:none;' onclick='setDisplay(""tips6"",false); execHTML(""Paste"");'></div> <span id='tips6' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 粘贴 ] -- 将复制内容这贴到光标处。<br>       可按“Ctrl A”选择全部内容,按此按钮全替换为粘贴内容。<br>       可使用鼠标选中部分文字,按此按钮替换为粘贴内容。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 6, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //7. 剪切 edt_cell.Width = 18; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips7"",true);' onmouseout='setDisplay(""tips7"",false);'style='width:18px;height:23px;border:none;' onclick='setDisplay(""tips7"",false); execHTML(""Cut"");'></div> <span id='tips7' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 剪切 ] -- 复制选中的内容并清除。<br>       可按“Ctrl A”选择全部内容,按此按钮全部复制并清除。<br>       可使用鼠标选中部分文字,按此按钮复制选中的文字内容并清除。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 13, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //8. 字体 edt_cell.Width = 31; s_loop = @"<div class='selectout' style='height:15px;width:30;position:absolute;left:10px;'>选择:  </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:50px;' onclick='setDisplay(""tips8"",false); setFonts (""宋体"");'>   1.宋体字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:110px;' onclick='setDisplay(""tips8"",false); setFonts (""黑体"");'>   2.黑体字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:170px;' onclick='setDisplay(""tips8"",false); setFonts (""楷体"");'>   3.楷体字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:60;position:absolute;left:230px;'onclick='setDisplay(""tips8"",false); setFonts (""微软雅黑"");'>   4.微软雅黑   </div>"; s_loop = "<div style='width:305px;height:40px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips8"",true);' style='width:31px;height:23px;border:none;'></div> <span id='tips8' class='custom info transparent' style='width:305px;height:40px;cursor:default;'><img src='images/info.png' height='48' width='48'>" "<em>[ 字体 ] -- 设置输入字体,或改变选中内容的字体。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //9. 样式 edt_cell.Width = 30; s_loop = @"<div class='selectout' style='height:15px;width:30;position:absolute;left:10px;'>选择:  </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:50px;' onclick='setDisplay(""tips9"",false); setFonts_style(""Bold"");'>   1.粗体字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:110px;' onclick='setDisplay(""tips9"",false); setFonts_style(""Italic"");'>   2.斜体字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:170px;' onclick='setDisplay(""tips9"",false); setFonts_style(""Underline"");'>   3.下划线   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:60;position:absolute;left:230px;'onclick='setDisplay(""tips9"",false); setFonts_style(""StrikeThrough"");'>   4.删除线   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:100;position:absolute;left:290px;'onclick='setDisplay(""tips9"",false); setFonts_style(""SuperScript"");'>   5.文字上标   </div>"; s_loop = "<div style='width:370px;height:40px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips9"",true);' style='width:30px;height:23px;border:none;'></div> <span id='tips9' class='custom info transparent' style='width:370px;height:40px;cursor:default;'><img src='images/info.png' height='48' width='48'>" "<em>[ 字体样式 ] -- 设置输入字体样式,或改变选中内容的字体样式。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 9, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //10. 字号 edt_cell.Width = 30; s_loop = @"<div class='selectout' style='height:15px;width:30;position:absolute;left:10px;'>选择:  </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:50px;' onclick='setDisplay(""tips10"",false); setFonts_size(""1"");'>   1.一号字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:110px;' onclick='setDisplay(""tips10"",false); setFonts_size(""2"");'>   2.二号字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:170px;' onclick='setDisplay(""tips10"",false); setFonts_size(""3"");'>   3.三号字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:230px;'onclick='setDisplay(""tips10"",false); setFonts_size(""4"");'>   4.四号字   </div> <div class='selectout' onmouseover=""this.className='selectover';"" onmouseout=""this.className='selectout'"" style='height:15px;width:40;position:absolute;left:290px;'onclick='setDisplay(""tips10"",false); setFonts_size(""5"");'>   5.五号字   </div>"; s_loop = "<div style='width:360px;height:40px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips10"",true);' style='width:30px;height:23px;border:none;'></div> <span id='tips10' class='custom info transparent' style='width:360px;height:40px;cursor:default;'><img src='images/info.png' height='48' width='48'>" "<em>[ 字体大小 ] -- 设置输入字体大小,或改变选中内容的字体大小。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //11. 颜色 edt_cell.Width = 30; string[] mcolor = new string[143]; mcolor[0] = "#ffff00"; mcolor[1] = "#00ff00"; mcolor[2] = "#00ffff"; mcolor[3] = "#ff00ff"; mcolor[4] = "#0000ff"; mcolor[5] = "#ff0000"; mcolor[6] = "#000080"; mcolor[7] = "#008080"; mcolor[8] = "#008000"; mcolor[9] = "#800080"; mcolor[10] = "#800000"; mcolor[11] = "#808000"; mcolor[12] = "#808080"; mcolor[13] = "#5F9EA0"; mcolor[14] = "#ffffff"; mcolor[15] = "#c0c0c0"; string scolor = "", bcolor = ""; for (int ic = 0; ic < 16; ic ) { scolor = scolor "<font style='color:" mcolor[ic] ";cursor:pointer' size=6;' onclick='operHTML(\"ForeColor\",\"" mcolor[ic] "\"); setDisplay(\"tips11\",false);'>■</font>"; } for (int ic = 0; ic < 16; ic ) { bcolor = bcolor "<font style='color:" mcolor[ic] ";cursor:pointer' size=6;' onclick='operHTML(\"BackColor\",\"" mcolor[ic] "\"); setDisplay(\"tips11\",false);'>■</font>"; } s_loop = @"<Table style='table-layout:fixed;width:260px;' cellspacing='0' cellpadding='0'> <TR> <TD style='width:60px;'><em>前景色:</em></TD> <TD style='line-height:15px;width:200px;word-wrap:break-word;'>" scolor @"</TD> </TR> <TR><TD></TD><TD style='color:#52aae7;'>------------------------------------</TD></TR> <TR> <TD><em>背景色:</em></TD> <TD style='line-height:15px;width:200px;word-wrap:break-word;'>" bcolor @"</TD> </TR> </Table> "; s_loop = "<div style='width:270px;height:128px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips11"",true);' style='width:30px;height:23px;border:none;'></div> <span id='tips11' class='custom info transparent' style='width:270px;height:128px;cursor:default;'><img src='images/info.png' height='48' width='48'>" "<em>[ 设置颜色 ] -- 设置输入内容的前景色和背景色。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 14, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //12. 左对齐 edt_cell.Width = 21; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips12"",true);' onmouseout='setDisplay(""tips12"",false);' style='width:21px;height:23px;border:none;' onclick='setDisplay(""tips12"",false); execHTML(""JustifyLeft"");'> </div> <span id='tips12' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 左对齐 ] -- 文字内容向左边对齐。<br>      可按“Ctrl A”选择全部内容,按此按钮全部向左对齐。<br>       可使用鼠标选中部分文字,按此按钮选中的文字内容向左对齐。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 5, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //13. 居中对齐 edt_cell.Width = 19; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips13"",true);' onmouseout='setDisplay(""tips13"",false);' style='width:19px;height:23px;border:none;' onclick='setDisplay(""tips13"",false); execHTML(""JustifyCenter"");'> </div> <span id='tips13' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 居中对齐 ] -- 文字内容居中对齐。<br>      可按“Ctrl A”选择全部内容,按此按钮全部居中对齐。<br>       可使用鼠标选中部分文字,按此按钮选中的文字内容居中对齐。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 5, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //14. 右对齐 edt_cell.Width = 19; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips14"",true);' onmouseout='setDisplay(""tips14"",false);' style='width:19px;height:23px;border:none;' onclick='setDisplay(""tips14"",false); execHTML(""JustifyRight"");'> </div> <span id='tips14' class='custom info transparent' style=' width:220px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 右对齐 ] -- 文字内容向右边对齐。<br>      可按“Ctrl A”选择全部内容,按此按钮全部向右对齐。<br>       可使用鼠标选中部分文字,按此按钮选中的文字内容向右对齐。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 17, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //15. 插入链接 edt_cell.Width = 32; s_loop = @"<div class='selectout' style='height:15px;width:30;position:absolute;left:10px;'> 链接地址:<input id='semailaddr' name='semailaddr' class='inputbox_bo' style='width:140px;'> </div> <div class='selectover' style='height:15px;width:40;position:absolute;left:220px;'> <p onclick='setlinkHTML(""semailaddr""); setDisplay(""tips15"",false);'>   [ 确定 ]   </p> </div>"; s_loop = "<div style='width:290px;height:45px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmousemove='setDisplay(""tips15"",true);getPos();document.getElementById(""semailaddr"").focus();' style='width:32px;height:23px;border:none;'></div> <span id=""tips15"" class='custom info transparent' onmouseover='setPos();' style='width:290px;height:45px;cursor:default;'><img src='images/info.png' height='48' width='48'>" "<em>[ 文字链接 ] -- 选择内容后,双击输入框,输入地址。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //16. 清除格式 edt_cell.Width = 17; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips17"",true);' onmouseout='setDisplay(""tips17"",false);' style='width:17px;height:23px;border:none;' onclick='setDisplay(""tips17"",false); execHTML(""RemoveFormat"");'> </div> <span id='tips17' class='custom info transparent' style=' width:260px;height:80px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 清除格式 ] -- 清除设置的字体、链接等格式。<br>      可按“Ctrl A”选择全部内容,按此按钮清除全部设置的样式。<br>       可使用鼠标选中部分文字,按此按钮选中文字内容设置的样式。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 17, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //17. 插入图像 edt_cell.Width = 31; s_loop = @"<div class='selectout' style='height:15px;width:30;position:absolute;left:10px;'> 图片地址:<input id='simgaddr' name='semailaddr' class='inputbox_bo' style='width:130px;'> </div> <div class='selectover' style='height:15px;width:40;position:absolute;left:210px;'> <p onclick='insertIMG (""simgaddr""); setDisplay(""tips17"",false);' >   [ 确定 ]   </p> </div>"; s_loop = "<div style='width:280px;height:45px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmousemove='setDisplay(""tips17"",true);getPos();' style='width:31px;height:23px;border:none;'></div> <span id=""tips17"" class='custom info transparent' onmouseover='setPos();' style='width:280px;height:45px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em>[ 插入图像 ] -- 双击输入框,输入图片的链接地址。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 5, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //18. 插入引用的文字 edt_cell.Width = 32; s_loop = @" <Table> <TR> <TD style='width:10px'></TD> <TD> <textarea id='squote' name='squote' class='inputbox_bo' style='width:245px;height:90px;left:10px'></textarea> </TD> </TR> <TR> <TD></TD> <TD> <div class='selectover' style='height:15px;width:40;position:absolute;left:210px;'> <p onclick='add_quote(""squote""); setDisplay(""tips18"",false);' >   [ 确定 ]   </p> </div> </TD> </TR> </Table> "; s_loop = "<div style='width:280px;height:140px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmousemove='setDisplay(""tips18"",true);getPos();' style='width:32px;height:23px;border:none;'></div> <span id=""tips18"" class='custom info transparent' onmouseover='setPos();' style='width:280px;height:140px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em>[ 插入引用 ] -- 双击输入框,输入引用的文字内容。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //19. 插入代码 edt_cell.Width = 32; s_loop = @" <Table> <TR> <TD style='width:10px'></TD> <TD> <textarea id='scode' name='scode' class='inputbox_bo' style='width:245px;height:90px;left:10px'></textarea> </TD> </TR> <TR> <TD></TD> <TD> <div class='selectover' style='height:15px;width:40;position:absolute;left:210px;'> <p onclick='add_code(""scode""); setDisplay(""tips19"",false);' >   [ 确定 ]   </p> </div> </TD> </TR> </Table> "; s_loop = "<div style='width:280px;height:140px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmousemove='setDisplay(""tips19"",true);getPos();' style='width:32px;height:23px;border:none;'> </div> <span id=""tips19"" class='custom info transparent' onmouseover='setPos();' style='width:280px;height:140px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em>[ 插入代码 ] -- 双击输入框,输入插入代码内容。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 7, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //20. 插入表格 edt_cell.Width = 32; s_loop = @" <Table> <TR> <TD style='width:10px'></TD> <TD style='width:60px'><em>表格行数:</em></TD> <TD><input id='s_R' name='s_R' class='inputbox_bo' style='width:50px'></TD> <TD style='width:15px'></TD> <TD style='width:60px'><em>表格列数:</em></TD> <TD><input id='s_T' name='s_T' class='inputbox_bo' style='width:50px'></TD> </TR> <TR> <TD></TD> <TD><em>表格宽度:</em></TD> <TD><input id='s_W' name='s_W' class='inputbox_bo' style='width:50px'></TD> <TD style='width:10px;'></TD> <TD><em>背景颜色:</em></TD> <TD><input id='s_C' name='s_C' class='inputbox_bo' style='width:50px'></TD> </TR> <TR> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD> <div class='selectover' style='height:15px;width:40;position:absolute;left:210px;'> <p onclick='add_table(""s_R"", ""s_T"", ""s_W"", ""s_C""); setDisplay(""tips20"",false);' >   [ 确定 ]   </p> </div> </TD> </TR> </Table> "; s_loop = "<div style='width:280px;height:100px;position:absolute;margin:-5px auto auto auto'>" s_loop "</div>"; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmousemove='setDisplay(""tips20"",true);getPos();' style='width:32px;height:23px;border:none;'> </div> <span id=""tips20"" class='custom info transparent' onmouseover='setPos();' style='width:280px;height:100px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em>[ 插入表格 ] -- 双击输入框,输入插入表格属性。<br></em>" s_loop "</span></a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 15, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //21. 打印 edt_cell.Width = 18; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips21"",true);' onmouseout='setDisplay(""tips21"",false);' style='width:18px;height:23px;border:none;' onclick='setDisplay(""tips21"",false); execHTML(""Print"");'> </div> <span id='tips21' class='custom info transparent' style=' width:220px;height:50px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 打印 ] -- 打印当前页面内容。<br>      打印时根据需要,先设置打印机的各项属性。 </em> </span> </a>"; edt_row.Cells.Add(edt_cell); interval(edt_cell, 10, edt_row); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// edt_cell = new TableCell(); //22. 字数统计 edt_cell.Width = 20; edt_cell.Text = @"<a class='tooltip' href='#'> <div onmouseover='setDisplay(""tips22"",true);gbcount(""abcEdit_mid"", ""t_size"")' onmouseout='setDisplay(""tips22"",false);' style='width:20px;height:23px;border:none;' onclick='setDisplay(""tips22"",false); execHTML(""RemoveFormat"");'> </div> <span id='tips22' class='custom info transparent' style=' width:220px;height:50px;cursor:default;'><img src='images/info.png' height='48' width='48'> <em> [ 统计字数 ] -- 统计生成的字符数量。<br><br>当前字符数:<l id='t_size'></l> </em> </span> </a>"; edt_row.Cells.Add(edt_cell); edt_cell = new TableCell(); edt_cell.Width = 33; edt_row.Cells.Add(edt_cell); edt_Table.Rows.Add(edt_row); edt_row = new TableRow(); edt_row.Height = 5; edt_cell = new TableCell(); edt_cell.ColumnSpan = 80; edt_row.Cells.Add(edt_cell); edt_Table.Rows.Add(edt_row); main_cell.Controls.Add(edt_Table); //所有加到表格中 } } }
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论