记得以前面试的时候遇到过这样一个问题:有一个表格,然后有4个输入框,一个合并按钮,输入框是这样的,从第几行到第几行,从第几列到第几列,然后点击按钮,合并 。当时我从学校出来,js知识只是知道一些,根本做不到!现在想想,其实这个问题也还是考基础功夫是否扎实!大家有兴趣可以自己做做看,测下自己是不是能够做出来。题目的截图: 现在做这个问题,看起来简单,但我还是花了很长时间,可能是我的思路不对吧?主要就是用...
代码如下:Information: { title: Info, width: 5%, sorting: false, edit: true, create: true, type:textarea, display: function (customerData) { var $img = $(<img src="content/images/document_properties.png" title="View and edit information" />); $img.click(function () { $(#CustomersTableContainer).jtable(openChildTable, $img.closest(tr), { title: customerData.record.Name + - Information, actions: { l...
代码如下:function ExportToExcel(tableId) //读取表格中每个单元到EXCEL中 { try{ var curTbl = document.getElementById(tableId); var oXL = new ActiveXObject("Excel.Application"); //创建AX对象excel var oWB = oXL.Workbooks.Add(); //获取workbook对象 var oSheet = oWB.ActiveSheet; var lenRow = curTbl.rows.lengt...
HTML的table结构如下: 代码如下:<table id="Dy_table" width="760" cellpadding="0" style="border-top: solid 1px #9cf" class="tableStyle1" cellspacing="0"> <tr> <th style="width: 40px">序号<input id="pageRows" name="pageRows" type="hidden" value="1" /> <input type="hidden" name="HF_tableRows" id="HF_tableRows" value="1" /></th> <th style="width:120px">零件型号</th> <th style="width:130px">零件名称</t...
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>WEB页面导出为EXCEL文档的方法</title> </head> <body> <table id="tableExcel" width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td c...
代码如下:$(#<%=AllEvent.ClientID%> tr:not(:has("th"))).hover(function () { $bg = $(this).css(background-color); $(this).css(background-color, #ffc4c6); }, function () { $(this).css(background-color, $bg); });
代码如下:$(#<%=AllEvent.ClientID%> tr:not(:has("th"))).hover(function () { $bg = $(this).css(background-color); $(this).css(background-color, #ffc4c6); }, function () { $(this).css(background-color, $bg); });
在<FORM>中加CSS <table> ....... </table> <form style="padding:0; margin:0;"> <input name=""> </form> <table> ....... </table> 注意:在火狐中 <table> <form>.......</form> </table>会出现问题 在网上看到过另一种说法,在table中创建form表单是不符合DOM标准的,会导致post失效,以及js数据传输失效。 特此铭记!@
代码如下:<pre name="code" class="html">前台调用(第一个参数是table的id): <input value="导出" type="button" /> function toExcel(inTblId, inWindow) { if ($.browser.msie) { //如果是IE浏览器 try { var allStr = ""; var curStr = ""; if (inTblId != null && inTblId != "" && inTblId != "null") { curStr = getTblData(inTblId, inWindow); } if (curStr != null) { allStr += curStr; } else { alert("你要导出的表不...
代码如下,可直接运行: 代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <SCRIPT LANGUAGE="JavaScript"> function autoRowSpan(tb,row,col) { var lastValue=""; var value=""; var pos=...
Table冻结表头: 代码如下:<script type="text/javascript"> function fixupFirstRow(tab) { var div=tab.parentNode; if(div.className.toLowerCase()=="freezediv"){ tab.rows[0].style.zIndex="1"; tab.rows[0].style.position="relative"; div.onscroll = function(){ var tr = tab.rows[0]; tr.style.top = this.scrollTop-(this.scrollTop==0?1:2); tr.style.left=-1; } } } window.onload = function(){ var tab=document.g...
代码如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> New Document </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT=""><META NAME="Keywords" CONTENT=""><META NAME="Description" CONTENT=""><script language="javascript">// Example: obj = findObj("image1");function findObj(theObj, theDoc){ var p, i, foundObj; if(!theDoc) theDoc = docu...
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script language="javascript" type="text/javascript"> function addRow() { var newTR = document.getElementById("testTable").insertRow(document.getElementById("testTable").rows.lengt...
【问题原因】 这个应该是 jquery.datatable 控件本身的一个缺陷。 该控件中的checkbox小插件的id是写死的,所以当有多个datatable引用到一个页面中的时候,全选事件会匹配全部的datatable,所以造成全部多个表格的checkbox被都被选中。 【解决方法】 所以最好是修改jquery.datatable控件,给生成的每个datatable下的checkbox赋 予不同的id,因为datatable的id是不一样的,所以可以把 datatable的id作为 checkbox的前缀组成一个唯一...
在页面上导入js 代码如下:jquery-1.3.2.min.jsjquery.tablednd_0_5.js注意:一定要先导入jquery-1.3.2.min.js 否则出错。建table 代码如下:<table id="table-1" cellspacing="0" cellpadding="2"> <tr id="1"><td>1</td><td>One</td><td>some text</td></tr> <tr id="2"><td>2</td><td>Two</td><td>some text</td></tr> <tr id="3"><td>3</td><td>Three</td><td>some text</td></tr> <tr id="4"><td>4</td><td>Four</...