(一):表单拼接
function addleader(){
var html = '<tr>'
+'<td width="15%" align="right" >现任领导</td>'
+'<td width="10%" align="left" ><input type="text" name="ldxx" readonly="readonly" value="" />'
+'<input type="hidden" name="ldxxId" value="" /> <input type="button" value="选择" οnclick="getleader(this)"/></td>'
+'<td width="10%" align="right" >就职时间</td>'
+'<td width="10%" style="text-align:left">'
+'<input type="text" readonly="readonly" class="Wdate" onClick="WdatePicker({skin:\'whyGreen\',dateFmt:\'yyyy-MM-dd\'});" name="jzsj" value="" /></td>'
+'<td width="5%" align="right" >现任职位</td>'
+'<td width="10%" style="text-align:left">'
/* <input type="text" readonly="readonly" name="xrzw" value=""><input type="text" readonly="readonly" name="xrzwId" value=""> */
+'</td>'
+'<td width="5%" align="center" >'
+'<img οnclick="up(this)" src="<%=request.getContextPath()%>/resources/imgs/buttons/upword.png">'
+'<img οnclick="down(this)" src="<%=request.getContextPath()%>/resources/imgs/buttons/downword.png">'
+'<img οnclick="delTr(this)" style="width:20px;height:20px" src="<%=request.getContextPath()%>/resources/imgs/buttons/delButton.png">'
+'</td>'
+'</tr>';
$("#info").append(html);
注:#info是指当前table的id
}
(二):表单<tr>循环取值
function getLedValues(){
var trList = $("#info(tableID)").children().children();
var jArray = "[";
for(var i=0;i<trList.length;i++){
var tdArr = trList.eq(i).find("td");
var Name = tdArr.eq(0).html();
var lId = tdArr.eq(1).find("input[type='hidden']").val();
var lName = tdArr.eq(1).find("input[name='ldxx']").val();
var Jzsj = tdArr.eq(2).html();
var lJzsj = tdArr.eq(3).find("input[name='jzsj']").val();
var xrzw = tdArr.eq(4).html();
var lxrzw = tdArr.eq(5).find("select[name='xrzwId']").val();
var o = "{"
+"'lName':'"+lName+"',"
+"'lId':'"+lId+"',"
+"'lJzsj':'"+lJzsj+"',"
+"'lxrzw':'"+lxrzw+"'"
+"},";
jArray += o;
}
jArray +="]";
return jArray;
}
(三):鼠标移入效果
.hoverpointer{cursor:pointer}
(四) :给当前<input>的同行<td>标签相应的<input>赋值
$($(this).parent().parent().find("input[name='jzsj']")).val(“123”);
(五)<select>下拉菜单数据循环拼接
success: function(results){
//将json字符串装成json对象
var treeData = eval('('+results+')');
var html = "";
$(treeData).each(function(){
html +="<option value='"+this.id+"'>"+this.name+"</option>";
});
$("#zrcs").html(html);
$("#zrcs").val('<%=_v.getZrcsbm()%>');
}
(六):通过点击选项获取子节点内容
$(function(){
$("input[name='bh']").bind("click",function(){
$("#dmbh").attr("readonly","readonly");
$("#bsave").attr("src","../resources/imgs/buttons/modify2.gif");
$("#bsave").attr("onclick","modify()");
/* $("#bmodify").attr("src","../resources/imgs/buttons/modify2.gif");
$("#bmodify").attr("onclick","modify()"); */
var l = $(this).parent().nextAll();
$("#LBMC").val($(l[1]).html());
$("#dmbh").val($(l[2]).html());
$("#FL").val($(l[3]).html());
$("#d_ms").val($(l[4]).html());
$("#d_pcode").val($(l[5]).html());
($("#d_uuid").val($(l[6]).html()));
/* $("#bmodify").replaceAll($("#bmodify")) */
});
});
(七)计算当前页面窗口大小:
$(document).ready(function(){
$("#listContent").css("width",$(document).width()*0.984+"px");
$("#listContent").css("height",$(document).height()*0.6+"px");
if($("#listContent").width()>$("#info").width()){
$("#info").css("width","100%");
}
if($("#listContent").height()>$("#info").height()){
$("#info").css("height","98%");
}
});
(八) JDK内存溢出配置:
-Xms512M -Xmx512M -XX:MaxPermSize=256M