A small example of a free editable table

xiaoxiao2021-03-06  50

A small example of a free editable table

/ / =============================== start ==================== ================

test modification form </ title> <style> / * Tip layer style * / Div {Border-Right: # 80c144 1px solid; border-top: # 80c144 1px solid; Visibility: hidden; border-left: # 80c144 1px solid; cursor: default; line-height: 20px; border-bottom: # 80c144 1px SOLID; FONT-FAMILY: Song; Font-size: 12px; Position: absolute; background-color: # f6f6f6; top: 30px; Left: 30px;} / * TR style * / tr {font-family: "Song" Color: # 000000; Background-Color: # c1dbf5; font-size: 12px} / * Table footnote style * /. Trfoot {font-size: 12px; font-family: "Song", "Verdana", "Arial" Background-color: # 6699cc; color: #fffff; height: 25;} / * TrHead property * /. TrHead {font-size: 13px; font-family: "Song", "Verdana", "Arial"; Background -Color: # 77Aadd; Color: #fffffff; Height: 25;} / * Text Box Style * / Input {Border-Color: # aacef7 # aacef7 # aacef7 # aacef7; border-right: 1px solid; border-top: 1px Solid; Border-Left: 1px Solid; Border-Bottom: 1PX Solid; Font -Size: 12px; Font-Family: "Song Body", "Verdana"; Color: # 000000; Background-Color: # e9eff5;} / * Button Style * / Button {Border-Color: # aacef7 # aacef7 # aacef7 # aacef7 Background-color: # d5e4f3; cursor: hand; font-size: 12px; border-right: 1px solid; border-top: 1px solid; border-left: 1px solid; border-bottom: 1px solid; color: # 000000 </ Style> </ head> <body> <script language = "javascript"> <! - global variable // flag bit, the value is false represents the end of the edit box, the value is true to open an editor Box Start Edit Var Editer_Table_cell_tag = false; // Turn on the editing function flag, the value is True to allow editing VAR RUN_EDIT_FLAG = false; // -> <</p> <p>/ Script> <script language = "javascript"> <! - / ** * Edit Table function * Click a cell to freely edit the content in the inside * @para TableID is the Table ID * @ @para TableID Para noediid is a TD ID of the TD, such as Table's title * can be written as <TD ID = "no_editer"> Free Edit Form </ td> * This TD cannot be edited * / function EditableCell (TableID, NOEDID) {var tdObject = event.srcElement; var tObject = ((tdObject.parentNode) .parentNode) .parentNode; if (tObject.id == tableId && tdObject.id = noEdiId && editer_table_cell_tag == false && run_edit_flag == true!) {tdObject.innerHTML = "<input type = text id = edit_table_txt name = edit_table_txt value =" tdObject.innerText "size = '15 'onKeyDown =' enterToTab () '> <input type = button value =' OK 'οnclick =' certainEdit () '> "; Edit_table_txt.focus (); edit_table_txt.select (); editer_table_cell_tag = true; // Modify button Tips EDITTIP.INNERTEXT =" Please determine the button first to confirm the modification! ";} Else {return false;}}</p> <p>/ ** * determining a modified * / function certainEdit () {var bObject = event.srcElement; var tdObject = bObject.parentNode; var txtObject = tdObject.firstChild; tdObject.innerHTML = txtObject.value; // editer_table_cell_tag representative of the edit box has been closed = false; // Modify button prompt information editip.innertext = "Please click on a cell to edit!";</p> <p>Function Entertainment Entertainment (Event.Srcelement.Type! = 'Button' && Event.Srcelement.Type! = 'Textarea' && Event.Keycode == 13) {Event.KeyCode = 9;}}</p> <p>/ ** * Control whether to edit * / function editstart () {if (event.srcelement.value == "Start Editing") {Event.Srcelement.Value = "Edit"; Run_Edit_Flag = true;} else {// If There is currently no editing box, then the editor is successful, otherwise, if you cannot submit / / must press the OK button to submit the IF (Editer_Table_cell_tag == false) {Alert ("Edit success!"); Event.srcelement.value = "Start Editing "; Run_EDit_flag = false;}}}</p> <p>/ ** * Provides different prompt information * / function showtip () {if (Event.Srcelement.Value == "editing") {edittip.style.top = event.y 15; edittip.style left = event.x 12; edittip.style.visibility = "visible";} else {edittip.style.visibility = "hidden";}} -> </ script> <Table ID = "Editer_Table" width = "100%" align = "οnclick =" editertablecell ('editer_table', 'no_editer')> <trilas = "trhead"> <td colspan = "3" align = "center" id = "no_editer"> Free Edit Form </ TD> </ TD> <33%> Click the Start Edit button, then click End Edit </ TD> <TD Width = "33%> 2 < / TD> <TD width = "33%"> 3 <TD> </ tr> <tr> <td width = "33%"> 4 </ td> <td width = "33%> 5 </ TD> <TD Width = "33%"> 6 </ TD> </ tr> <tr> <td width = "33%> One </ td> <td width =" 33%> TW </ TD > <Td width = "33%> Three </ td> </ tr> <tr> <td width =" 33%> flar </ td> <td width = "33%> FIVE </ TD> <Td width = "33%"> Six </ TD> </ tr> <tr class = "trfoot"> <td color = "3" align = "center" id = "no_editer"> <input type = "Button "Class =" BT "value =" Start Editing "OnClick =" editstart () "OnMouseOver =" showtip () "onM" ONM Ousemove = "showtip ()" onmouseout = "edittip.style.visibility =</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-116099.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="116099" 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.046</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 = 'G5vOPDPTKkNsK8yd9DC_2BTszAIrrNQSu9P1s5nJnjOWJHshuE0F7KtK0tlOF2StR0kKsFwdD_2BkP9RRkkAogwNKQ_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>