tabel表格的dom操作
2024-09-21 03:19:21
对table表格的操作比较麻烦,一直字符串的连接会比较麻烦
var nod = cwgk_msg_list.insertRow();//这个是上边获取过的dom元素,一般是tbody的元素,对元素进行操作,
cell = nod.insertCell();
cell.setAttribute("align","center");
cell.innerHTML=json[i].name;//名称 //这三部是必须的,第一不是增加一个表格,第二部设置表格的属性,第三部:为td赋值
cell = nod.insertCell();
cell.setAttribute("align","center");
cell.innerHTML=json[i].description;//说明
cell = nod.insertCell();
cell.setAttribute("align","center");
var sele="<select id='wechat_id"+i+"' class='jui-form-select' style='width:160px;'><option value='1'>1</option></select>";
cell.innerHTML= sele;//模板名称
cell = nod.insertCell();
cell.setAttribute("align","center");
if(json[i].disabled == "1")
{
var option = '<option value="1" selected>启用</option><option value="2">不启用</option>';
}
else
{
var option = '<option value="1">启用</option><option value="2" selected>不启用</option>';
}
cell.innerHTML= "<select name='' id='disab"+i+"' class='jui-form-select'>"+option+"</select>";//是否启用
cell = nod.insertCell();
// cell.setAttribute("align","center");
var sele="<select id='wechat_id_msg"+i+"' multiple size=1 data-jgselect class='jui-form-select' style='width:160px;'>"+op+"</select>";
cell.innerHTML= sele;//公众号
cell = nod.insertCell();
cell.setAttribute("align","center");
cell.setAttribute("class","timeago");
cell.setAttribute("title", json[i].update);
cell.innerHTML= json[i].update;//更新时间
cell = nod.insertCell();
cell.setAttribute("align","center");
var btn='<button class="jui-form-button" type="button" onclick="save_msg(\''+json[i].id+'\',\''+json[i].template+'\',document.getElementById(\'disab'+i+'\').value,document.getElementById(\'wechat_id_msg'+i+'\'))">保存</button>'
cell.innerHTML = btn;//保存按钮
最新文章
- hibernate笔记--单向多对一映射方法
- 【配置属性】—Entity Framework 对应表字段的类型的设定配置方法
- 虚拟化 模板制作 rhev笔记
- 移动端调试利器 JSConsole 介绍
- OSG使用更新回调来更改模型
- Android用户界面 UI组件--TextView及其子类(二) Button,selector选择器,sharp属性
- YII 小部件实现Area textArea
- python命令行解析工具argparse模块【1】
- C#的事件处理机制
- MVC写在Model文件夹下,登录注册等页面定义的变量规则,不会被更新实体模型删除
- javascript 浏览器
- lua 数组
- 基于Jmeter的轻量级接口压力测试(一)
- (转)iOS-Runtime知识点整理
- HDU2008
- 使用input file上传文件中onChange事件只触发一次问题
- npm 离线安装依赖
- Hessian的使用以及理解
- SSM整合配置(Spring+Spring MVC+Mybatis)
- firefox快捷键窗口和标签类
热门文章
- (转)SQLServer查询数据库各种历史记录
- django 补充和中间件
- [Oracle,2018-03-01] oracle常用函数
- win10家庭版 监听无法启动 报TNS-12560 TNS-00530
- web服务器案例
- OpenStack Trove组件WSGI和RPC调用流程(参考调用的整个过程)
- 深度学习原理与框架-Alexnet(迁移学习代码) 1.sys.argv[1:](控制台输入的参数获取第二个参数开始) 2.tf.split(对数据进行切分操作) 3.tf.concat(对数据进行合并操作) 4.tf.variable_scope(指定w的使用范围) 5.tf.get_variable(构造和获得参数) 6.np.load(加载.npy文件)
- 使用Nexus2搭建Maven本地仓库
- postgresql数据库varchar、char、text的比较
- 初学JSON和AJAX心得透过解惑去学习