鼠标拖动改变单元格大小.docVIP

  • 6
  • 0
  • 约3.63千字
  • 约 6页
  • 2017-12-27 发布于河南
  • 举报
鼠标拖动改变单元格大小

鼠标拖动改变单元格大小 %@ page language=java import=java.util.* pageEncoding=UTF-8% % String path = request.getContextPath(); String basePath = request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/; % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head title鼠标拖动改变编辑表格大小/title meta http-equiv=Content-Type content=text/html; charset=utf-8 / SCRIPT language=javascript var theobject = null; function resizeObject() { this.el = null; this.dir = ; this.grabx = null; this.graby = null; this.width = null; this.height = null; this.left = null; this.top = null; } function getDirection(el) { var xPos, yPos, offset, dir; dir = ; xPos = window.event.offsetX; yPos = window.event.offsetY; offset = 8; //The distance from the edge in pixels if (yPosoffset) dir += n; else if (yPos el.offsetHeight-offset) dir += s; if (xPosoffset) dir += w; else if (xPos el.offsetWidth-offset) dir += e; return dir; } function doDown() { var el = getReal(event.srcElement, className, resizeMe); if (el == null) { theobject = null; return; } dir = getDirection(el); if (dir == ) return; theobject = new resizeObject(); theobject.el = el; theobject.dir = dir; theobject.grabx = window.event.clientX; theobject.graby = window.event.clientY; theobject.width = el.offsetWidth; theobject.height = el.offsetHeight; theobject.left = el.offsetLeft; theobject.top = el.offsetTop; window.event.returnValue = false; window.event.cancelBubble = true; } function doUp() { if (theobject != null) { theobject = null; } } function doMove() { var el, xPos, yPos, str, xMin, yMin; xMin = 8; yMin = 8; el = getReal(event.srcElement, className, resizeMe); if (el.className == resizeMe) { str = getDirection(el); if (str == ) str = default; else str += -resize; el.style.cursor = str; } if(theobject != null) { if (dir.indexOf(e) != -1) theobject.el.style.width = Math.max(xMin, theobject.width + window.event.clientX - theobject.grabx) + px; if (dir

文档评论(0)

1亿VIP精品文档

相关文档