首页 > 其他分享 >按钮触发table添加一行删除一行

按钮触发table添加一行删除一行

时间:2023-09-07 11:33:40浏览次数:35  
标签:function addconectField nFieldCount 一行 newTd width 按钮 var table


<!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

相关文章

  • Every derived table must have its own alias(sql语句错误解决方法)
    1、执行下面语句时,报错Everyderivedtablemusthaveitsownaliasselect*from(select*fromjt_noteswherecreateUser='b548323007b647809bb8e4192cf44195'limit0,10)2、解决方案,加一个别名就可以了select*from(select*fromjt_noteswherecreateUs......
  • 你折腾一天都装不上的插件,函数计算部署 Stable Diffusion 都内置了
    在进行函数计算StableDiffusion答疑的过程中,遇到很多同学在装一些插件的过程中遇到了难题,有一些需要安装一些依赖,有一些需要写一些代码,很多时候安装一个插件就能折腾几天,我们收集了很多同学需要的插件,这一次把比较难装的StableDiffusion插件都装好了。可以根据自己的需要自......
  • vxe-table 的 setActiveRow() 无效
    问题vxe-table的setActiveRow(row)方法无效。解决检查之后发现,vxe-column上忘记写:edit-render="{}。因为#edit="{row}"插槽必须要写:edit-render="{}......
  • 你折腾一天都装不上的插件,函数计算部署 Stable Diffusion 都内置了
    在进行函数计算StableDiffusion答疑的过程中,遇到很多同学在装一些插件的过程中遇到了难题,有一些需要安装一些依赖,有一些需要写一些代码,很多时候安装一个插件就能折腾几天,我们收集了很多同学需要的插件,这一次把比较难装的StableDiffusion插件都装好了。可以根据自己的需要自行......
  • iptable 设置指定端口访问
    一、添加规则:设置禁止所有IP访问指定端口8075[root@zabbix_server~]#iptables-IINPUT-ptcp--dport8075-jDROP二、测试telnet [root@zabbix_server~]#telnet127.0.0.18075Trying127.0.0.1...telnet:connecttoaddress127.0.0.1:Connectiontimedout......
  • a-table 控制列的展示和隐藏
    https://www.cnblogs.com/evident/p/16700615.htmltabkeColumns:[{title:'姓名',dataIndex:'name',key:'name',colSpan:(route.path==='SIM'?1:0)//如果页面是SIM则显示该列,否......
  • Android官方资料--Adoptable Storage
    AdoptableStorageINTHISDOCUMENTSecurityPerformanceandstabilityAndroidhasalwayssupportedexternalstorageaccessories(suchasSDcards),buttheseaccessorieswerehistoricallylimitedtosimplefilestorage,duetotheirexpectedimpermanence......
  • vxe-table 坑:可编辑表格表头不显示编辑图标
    问题"vxe-table":"^3.5.9",官方文档默认显示编辑图标。但实际上没有显示。给vex-table的edit-config添加showIcon:true,也不生效。设置icon也不生效。替代方案给vxe-column设置插槽<template#default="{row}"></template>,内部显示内容添加icon。新的问题插......
  • IOS-开发获取tableview中cell的最终渲染宽度
    如图 我想要实现一个cell,里面有一个白色的消息区域宽度是整个cell的宽度减少20pt, 于是我写了_msgview.frame=CGRectMake(10,_time.bounds.origin.x+30,self.contentView.bounds.size.width-20,80);贴上完整代码-(instancetype)initWithStyle:(UITableViewCellStyle)......
  • <br /> <font size= 1 ><table class= xdebug-error xe-notice dir= ltr border= 1
    PHP传给前端的值有大量html代码错误1:html代码中,发送请求,多加了引号 ......