Htc data table

Source: Internet
Author: User
Tags tagname
Tip: you can modify some code before running

<HTML><HEAD><TITLE></tITLE></hEAD><style>body{font-size:12}table,input,button,select,textarea,b{font-size:12;font-family:宋体}body{background:#ECE9D8}td{border:1px solid #c0c0c0;display:inline}.GridBorder{background:#ece9d8;border:1px solid #000;border-top:1px solid #FFF;border-left:1px solid #FFF;text-align:center;WORD-BREAK:break-all}</style><script>if(document.all){Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1){node=node.parentNode}return node})Event.prototype.__defineGetter__("x",function(){return this.clientX+2})Event.prototype.__defineGetter__("y",function(){return this.clientY+2})}function $(obj){return document.getElementById(obj)}</script><BODY><table id=datagrid> <tr> <td width=15></td> <td width=50>Field 1</td> <td width=50>Field 2</td> <td width=50>Field 3</td> <td width=50>Field 4</td> <td width=50>Field 5</td> <td width=50>Field 6</td> <td width=50>Field 7</td> <td width=50>Field 8</td> <td width=50>Field 9</td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr></table></bODY></hTML><script>var obj=$("datagrid"),tdvar body=document.bodyvar DragObj=nullvar objxy=getxy(obj)var Dragborder=0obj.style.cssText="background:#FFF;border-collapse:collapse"for(var i=0;i<obj.rows.length;i++){for(var j=0;j<obj.rows[i].cells.length;j++){td=obj.rows[i].cells[j]if(i==0){td.className="GridBorder"td.style.cssText="font-weight:bold"}else if(j==0){td.className="GridBorder"td.style.cssText="width:15px"}else{td.innerHTML="<input type=text value='"+td.innerHTML.replace(/ /gi,'')+"' >"}}}var focus_img=document.createElement("IMG")focus_img.src="http://bbs./attachment.php?aid=7290&noupdate=yes"if(typeof(Dline)!="object"){var Dragline=document.createElement("DIV")Dragline.id="Dline"Dragline.style.cssText="width:1px;border-left:1px solid #CCC;display:none;position:absolute"body.appendChild(Dragline)}obj.onclick=function(){var e=event,trvar ee=e.srcElementif(ee.tagName=="INPUT"){tr=ee.parentNode.parentNodeobj.rows[tr.rowIndex].cells[0].appendChild(focus_img)}}obj.onmousemove=function(){var e=event,trvar ee=e.srcElementif(ee.tagName=="TD"&&ee.parentNode.rowIndex==0&&ee.cellIndex>0){var a=getxy(ee)if(event.x<(a[1]+5)||event.x>(a[1]+a[2]-5)){body.style.cursor="col-resize"objxy=getxy(obj)}else{body.style.cursor="default"}}}obj.onmousedown=function(){var e=eventvar ee=e.srcElementvar a=getxy(ee)if(body.style.cursor=="col-resize"){if(event.x<(a[1]+5))Dragborder=1else if(event.x>(a[1]+a[2]-5))Dragborder=2elseDragborder=0DragObj=ee$("Dline").style.left=e.x$("Dline").style.top=objxy[0]$("Dline").style.height=objxy[3]$("Dline").style.display=""}}body.onmousemove=function(){if(DragObj!=null){$("Dline").style.left=event.xbody.style.cursor="col-resize"}}body.onmouseup=function(){if(DragObj!=null){$("Dline").style.display="none"body.style.cursor="default"if(Dragborder==2){var a=getxy(DragObj)var w=event.x-a[1]w=w<=0?0:wDragObj.style.width=w}if(Dragborder==1){var pnode=DragObj.previousSiblingvar a=getxy(pnode)var w=event.x-a[1]w=w<=0?0:wpnode.style.width=w}DragObj=null}}function getxy(e){var a=new Array()var t=e.offsetTop;var l=e.offsetLeft;var w=e.offsetWidth;var h=e.offsetHeight;while(e=e.offsetParent){t+=e.offsetTop;l+=e.offsetLeft;}a[0]=t;a[1]=l;a[2]=w;a[3]=h return a;}</script>
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.