<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>addHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css" mce_href="styles.css">-->
<mce:script type="text/javascript"><!--
var nFieldCount =0;
function addSearchCondition(){
var tabCondition =document.getElementById("tabCondition");
var tabBody = tabCondition.firstChild;
var newTr = tabBody.insertRow();
//添加列
var newTd = new Array();
nRowCount = tabBody.children.length - 1;
for(i= 0; i < 7; i++){
newTd[i] = newTr.insertCell();
if(i==6){
newTd[i].innerHTML = "<a href="#" mce_href="#" οnclick=/"delTabConditionRow('"+ nRowCount +"')/">删除</a>";
newTd[i].width="5%";
}
}
nFieldCount++;
addCaptionField(newTd[0]);
addTextField(newTd[1]);
addconectField(newTd[2]);
nFieldCount++;
addCaptionField(newTd[3]);
addTextField(newTd[4]);
addconectField(newTd[5]);
}
function addTextField(newTd){
newTd.innerHTML = "<input id='propValues"+ nFieldCount +"' name='propValues' type='text' class='st_text' />";
newTd.width="30%";
newTd.height="28";
newTd.className ="FieldValue2";
}
function addCaptionField(newTd){
newTd.innerHTML = "<select name ='"+ "propIds"
+"' id='"+ "propId" + nFieldCount +"' >"
+"</select>";
newTd.height="28";
newTd.width="10%";
newTd.align='right';
newTd.className ="FieldTitle";
// var selectId = $("propId"+ nFieldCount);
//addSelectItem(selectId);
}
function addconectField(newTd ){
var strInnerHTML = "<select name =conditions" +" id=condition"
+ nFieldCount +">"
+" <option value=/"and/" selected >并且</option>"
+" <option value=/"or/">或者</option></select>";
newTd.innerHTML = strInnerHTML;
newTd.height="28";
newTd.width="10%";
newTd.className ="FieldValue2";
}
function delTabConditionRow(deletrow){
var tabCondition =document.getElementById("tabCondition");
var tabBody = tabCondition.firstChild;
tabBody.deleteRow(deletrow);
for(var i=1;i<tabBody.children.length;i++){
tabBody.rows[i].cells[6].innerHTML= ' <a href="javascript:void(0)" mce_href="javascript:void(0)" οnclick="delTabConditionRow('+i+')">删除</A>';
}
}
// --></mce:script>
</head>
<body>
<input type="button" value="新增" οnclick="addSearchCondition()" />
<table id=tabCondition width='100%' align='center' cellpadding='0'
cellspacing='0'>
<tr height="28">
<td width="10%" class='FieldTitle' align="right">
字段名称
</td>
<td width="30%" class='FieldTitle' align="center">
查询值
</td>
<td width="10%" class='FieldTitle'>
连接条件
</td>
<td width="10%" class='FieldTitle' align="right">
字段名称
</td>
<td width="25%" class='FieldTitle' align="center">
查询值
</td>
<td width="10%" class='FieldTitle'>
连接条件
</td>
<td width="5%" class='FieldTitle'>
操作
</td>
</tr>
</table>
</body>
</html>
标签:function,addconectField,nFieldCount,一行,newTd,width,按钮,var,table
From: https://blog.51cto.com/u_2544485/7395490