[Table full-featured demo (including add, delete, move, cell selection, line selection, etc.)]

xiaoxiao2021-03-06  97

Everyone is saved locally! Sample (DHTML DUDE) </ Title> <style> TR {Background-Color: White; Color: Black; Font-Family: Verdana; Font-Size: 20; Font-Weight: bold: bold } </ stop> <xml> <mshelp: keyword index = "a" term = "tableedit" /> </ xml> </ head> <! - Toolbar_Start -> <! - TOOLBAR_EXEMPT -> < ! - Toolbar_end -> <body style = "font-family: verdana"> <h2> Table Editor </ h2> <br> <h3> Click Select cell, press the Alt button to select a line! </ h3> <br> <div id = TableContainer> <Table ID = THTABLE BORDER = 1 style = "Border-Collapse: collapse; table-layout: fixed"> <tbody> <tr> <td> Cell 1, 1 </ TD> <TD> Cell 1, 2 </ TD> <TD> Cell 1, 3 <TD> </ TR> <Tr> <TD> Cell 2, 1 </ TD> <TD> Cell 2, 2 </ td> <TD> Cell 2, 3 </ TD> </ TD> <TD> Cell 3, 1 </ TD> <TD> Cell 3, 2 </ TD> <TD> Cell 3 3 </ td> </ tr> </ tbody> </ table> </ div></p> <p><br> <br> <br></p> <p><Input ID = ButtonAddrow Style = "Width: 200px;" Type = Button Value = "Add" οnclick = "addrow ()> <BR> <input id = buttonremoverow style =" width: 200px; "Type = Button Value = "Remove Row" οnclick = "removeRow ()"> <br> <input id = ButtonAddCell style = "width: 200px;" type = button value = "Add Cell" οnclick = "addCell ()"> <br> < input id = ButtonRemoveCell style = "width: 200px;" type = button value = "Remove Cell" οnclick = "removeCell ()"> <br> <input id = ButtonMoveUp style = "width: 200px;" type = button value = "Move Up" οnclick = "MoveUp ()> <input id = buttonmovedown style =" width: 200px; "Type = Button value =" οnclick = "MOVEDOWN ()"> <BR> <input ID = ButtonMoveleft Style = "Width: 200px;" TYPE = Button value = "Move Left" οnclick = "MOVELEFT ()> <input id = buttonmoveright style =" Width: 200px; "type = button value =" Move Right "οnclick =" Moveright ()> <br> <input id = buttoneditcontents style = "width: 200px;" type = button value = "edit contents" οnclick = "editcontents ();"> <input type = Text Style = "Display: none; width: 400px;" ID = Editcell> <br> <input ID = ButtonEditStyle Style = "Width: 200px;" Type = Button Value = "Edit Table Style" οnclick = "EditStyle ();"> <input type = text style = "DISPLAY: NONE; Width: 400px;</p> <p>"Id = EditStyle> <br> <script> var lastSelection = null; ButtonAddRow.setExpression (" disabled "," nothingSelected (lastSelection) "); ButtonRemoveRow.setExpression (" disabled "," rowSelected (lastSelection) "!); ButtonAddCell .setExpression ( "disabled", "nothingSelected (lastSelection)"); ButtonRemoveCell.setExpression ( "disabled", "cellSelected (lastSelection)!"); ButtonMoveUp.setExpression ( "disabled", "rowSelected (lastSelection)!"); ButtonMoveDown .setExpression ( "disabled", "rowSelected (lastSelection)!"); ButtonMoveLeft.setExpression ( "disabled", "! cellSelected (lastSelection)"); ButtonMoveRight.setExpression ( "disabled", "! cellSelected (lastSelection)"); ButtonEditcontents.sexpression ("DISABED", "(! CellSelected (lastselection)) || (Editcell.Style.Display == ')"); ButtoneditStyle.seTexpression ("Disabled", "(EditStyle.Style.Display ==' ') "); ButtoneditStyle.seTexpression (" Value ","' Edit ' WhatisSselected (LastSelection) ' Style ')</p> <p>Function select {var e, r, c; if (element == null) {e = window.event.srcelement;} else {e = element;} f ((window.event.altkey) || (e .TAGNAME == "Tr")) {r = findrow (e); if (r! = null) {if (lastselection! = null) {deselectroworcell (LastSelection);} SELECTROWORCELL (R); LastSelection = r;}} Else {c = findcell (e); if (c! = null) {if (lastselection! = null) {deselectroworcell (LastSelection);} selectroWorcell (c); LastSelection = C;}} window.event.cancelbubble = true; }</p> <p>TableContainer.onclick = SELECT</p> <p>Function cancelselect () {</p> <p>IF (window.event.srcelement.tagname! = "body") Return;</p> <p>IF (LastSelection! = null) {deselectrical (lastselection); LastSelection = null;}}</p> <p>Document.onclick = cancelselect;</p> <p>Function Findrow (e) {if (e.tagname == "tr") {return e;} else if (e.tagname == "body") {return null;} else {return findrow (E.ParenTelement);} }</p> <p>Function Findcell (e) {if (e.tagname == "TD") {RETURN E;} else if (e.tagname == "body") {return null;} else {return findcell (E.PARENTELEMENT);} }</p> <p>Function performance = "; r.Runtimestyle.color ="; //r.RuntimeStyle.FontFamily = "verdana";}</p> <p>Function SELECTROWORCELL (R) {R.RuntimeStyle.BackgroundColor = "DarkBlue"; R.RuntimeStyle.Color = "White"; //r.RuntimeStyle.fontfamily = "verdana";</p> <p>Function addrow () {var r, p, nr; if (lastselection == null) {r = null; p = THTABLE.CHILDREN [0];} else {r = lastselection; if (r.tagname == "TD" ) {R = r.parentelement;}</p> <p>P = r.parentelement;</p> <p>NR = Document.createElement ("TR");</p> <p>P. Isertbefore (NR, R);</p> <p>SELECT (NR);</p> <p>AddCell ();</p> <p>Return nr;}</p> <p>Function removerow () {var r, p, nr; if (lastselection == null) Return FALSE</p> <p>R = LastSerection;</p> <p>IF (r.tagname == "td") {r = r.parentelement;}</p> <p>P = r.parentelement;</p> <p>P.RemoveChild (r);</p> <p>LastSelection = NULL; RETURN R;}</p> <p>Function addCell () {var r, p, c, nc, text; if (lastselection == null) Return False;</p> <p>R = LastSerection;</p> <p>IF (r.tagname == "td") {r = r.parentelement; c = lastselection;} else {c = null;}</p> <p>NC = Document.createElement ("TD"); text = document.createtextNode ("new cell");</p> <p>nc.insertbefore (Text, Null); R.Insertbefore (NC, C);</p> <p>SELECT (NC);</p> <p>Return nc;}</p> <p>Function removecell () {var C, p, nr; if (lastselection == null) Return False;</p> <p>C = LastSerection;</p> <p>IF (c.tagname! = "td") {Return Null;}</p> <p>P = C.Parentelement;</p> <p>P.RemoveChild (C);</p> <p>LastSelection = NULL; RETURN C;</p> <p>Function editcontents () {var C, p, nr; if (lastselection == null) Return False;</p> <p>C = LastSerection;</p> <p>IF (c.tagname! = "td") {Return Null;}</p> <p>Editcell.Style.display = "";</p> <p>Editcell.Value = C.INNERHTML;</p> <p>C.seXpression ("InnerHtml", "Editcell.Value");</p> <p>Editcell.focus ();</p> <p>Editcell.onblur = unhookContentSexpression;}</p> <p>Function unhookContentSexpression () {LastSelection.RemoveExpression ("innerhtml"); editcell.Value = ''; editcell.style.display = "none";} function editsTyle () {var C;</p> <p>IF (lastselection == null) {c = thetable;} else {c = lastselection;} EditStyle.style.display = ""</p> <p>EditStyle.Value = C.Style.csstext;</p> <p>C.Style.seTexpression ("CSSText", "EditStyle.Value);</p> <p>EditStyle.focus ();</p> <p>EditStyLle.onblur = unhookStyleExpression;}</p> <p>Function unhookStyleExpression () {var C;</p> <p>IF (lastselection == null) {c = thetable;} else {c = lastselection;} C.Style.RemoveExpression ("csstext");</p> <p>EditStyle.Value = '; edstyle.style.display = "none";</p> <p>Function moveup () {var r, p, ls; if (lastselection == null) Return False;</p> <p>R = LastSerection;</p> <p>IF (R.Tagname! = "TR") {Return Null;}</p> <p>IF (R.RowIndex == 0) Return;</p> <p>Ls = r.previoussibling;</p> <p>P = ls.parentelement;</p> <p>P. Insertbefore (R, LS);</p> <p>Return R;</p> <p>Function movedown () {var r, p, ls; if (lastselection == null) Return False;</p> <p>R = LastSerection;</p> <p>IF (R.Tagname! = "TR") {Return Null;}</p> <p>Ls = r.nextsibling;</p> <p>IF (ls == null) Return NULL;</p> <p>P = ls.parentelement;</p> <p>Ls = ls.nextsibling;</p> <p>P. Insertbefore (R, LS);</p> <p>Return R;</p> <p>Function movetleft () {var C, p, ls; if (lastselection == null) Return False;</p> <p>C = LastSerection;</p> <p>IF (c.tagname! = "td") {Return Null;}</p> <p>Ls = C.PREVIOUSIBLING;</p> <p>IF (ls == null) Return NULL;</p> <p>P = ls.parentelement;</p> <p>P. Insertbefore (C, LS);</p> <p>Return C;</p> <p>Function moveight () {var C, p, ls; if (lastselection == null) Return False; C = LastSerection;</p> <p>IF (c.tagname! = "td") {Return Null;}</p> <p>Ls = C.NEXTSIBLING;</p> <p>IF (ls == null) Return NULL;</p> <p>P = ls.parentelement;</p> <p>Ls = ls.nextsibling;</p> <p>P. Insertbefore (C, LS);</p> <p>Return C;</p> <p>Function NothingSelected () {return (lastselection == null);</p> <p>Function RowSelected () {var C; if (LastSelection == Null) Return False;</p> <p>C = LastSerection;</p> <p>Return (c.tagname == "tr")}</p> <p>Function cellselected () {var C; if (lastselection == null) Return False;</p> <p>C = LastSerection;</p> <p>Return (c.tagname == "td")}</p> <p>Function whatisselected () {if (lastselection == null) Return "table"; if (lastselection.tagname == "TD") Return "cell"; if (LastSelection.tagname == "Tr") Return "row";</p> <p></ script></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-97561.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="97561" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.047</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'Q5_2B6fmtH5GihPvxw7PRENgZ6HdLfL4JctIupC_2BAa2urBUhCfNMjlGnSLNZa6IA_2FANbd5KJR4lo4qv4v7DinCzg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>