当前位置: 代码迷 >> Web前端 >> 双击报表可修改
  详细解决方案

双击报表可修改

热度:176   发布时间:2013-07-08 14:13:00.0
双击表格可修改
function tdclick(obj) {
             
		var txt = $(obj.outerHTML).text();
		if (txt != null && txt != "") {
			if (obj.childNodes.length > 0) {
				obj.childNodes[0].data = '';
			} else {
				obj.textContent = "";
			}
		}
              //td表格里加input将值赋予input记录下,在删除input框
		var inputobj = ($("<input type='text'  maxlength='60' style='width: 100%; height: 15px'/>")
				.css("border", "0")).css("background-color", "#FFFFCC")
				.appendTo(obj);
		inputobj.trigger("focus");
		inputobj.val(" " + txt);
		inputobj
				.focusout(function() {
					if (obj.childNodes[0].nodeName == "#text") {
						obj.childNodes[0].data = inputobj.val();
					} else {
						obj.innerHTML = inputobj.val();
					}
					inputobj.remove();
					var oper = obj.id;
					if (oper !== 'add') {
						if (updateIds == "") {
							updateIds = obj.id + ";" + inputobj.val() + ";";
						} else {
							updateIds = updateIds + "@" + obj.id + ";"
									+ inputobj.val() + ";" ;
						}
					}
				});
		$(obj.outerHTML).find("input[value='']").remove();
	}

?

  相关解决方案