js中拼接html文档之onclick函数处理
来源:互联网 发布:淘宝退款会影响信誉吗? 编辑:程序博客网 时间:2024/06/09 18:43
拼接html文档时,对于onclick如何拼接:
2.若onclick函数参数有特殊字符,传参数会有问题,可以采取元素上加属性的方法,把参数传出去。
1.直接拼接onclcik函数
function setNameplate(obj){var str = "";var name = $(obj).prev("span").text();str = '<input type="text" id="nameplate" value='+name+'>'+ '<button class="btn-confirm" onclick="confirmNameplate(this)">确定</button>'+ '<button class="btn-cancel" onclick="cancelNameplate(this,\''+name
+ '\')">取消</button>';$(obj).parent().html(str);}
2.若onclick函数参数有特殊字符,传参数会有问题,可以采取元素上加属性的方法,把参数传出去。
//视频if(executeInfo[i].file_type == "3" || executeInfo[i].record_type == "1"){console.log(executeInfo[i].folder+ ','+executeInfo[i].file_name);videostr = videostr + '<tr class="videoTr">' + '<td style="width: 10%" title="'+executeInfo[i].create_user+'">' + executeInfo[i].create_user + '</td>' + '<td style="width: 10%" title="'+executeInfo[i].device_id +'">' + executeInfo[i].device_id + '</td>' + '<td style="width: 15%" title="'+executeInfo[i].execute_time+'">' + executeInfo[i].execute_time + '</td>' + '<td style="width: 20%" title="'+executeInfo[i].descr+'">' + executeInfo[i].descr + '</td>' + '<td style="width: 15%" title="'+executeInfo[i].beginTime+'">' + executeInfo[i].beginTime + '</td>' + '<td style="width: 15%" title="'+executeInfo[i].endTime+'">' + executeInfo[i].endTime + '</td>' + '<td style="width: 10%" title="'+executeInfo[i].upload_name+'">' + executeInfo[i].upload_name + '</td>' + '<td style="width: 5%; text-align: center;">' + '<a class="play" folder="' + executeInfo[i].folder + '" file_name="' + executeInfo[i].file_name+ '">'+'播放' +'</a>'+'</td>' + '</tr>';}
$(document).on("click", "tr.videoTr a.play", function() {var folder = $(this).attr("folder");var file_name = $(this).attr("file_name");videojs("video_play",{}).ready(function(){ var myPlayer = this; myPlayer.src("../"+folder+"/"+file_name); myPlayer.play();});return false;});
阅读全文
0 0
- js中拼接html文档之onclick函数处理
- js中拼接的html代码中的onclick事件解析错误
- js拼接html中调用onclick方法传递的参数问题
- js 拼接HTML字符串 onclick事件传多个参数问题
- js中html字符串拼接
- js中字符串拼接html
- js设置html标签的onclick函数
- html页面调用js文件里的函数报错onclick is not defined处理方法
- HTML+JS基础之a标签href与onclick事件的冲突处理
- js中处理鼠标单击事件 onclick
- html页面调用js文件里的函数报错onclick is not defined处理方法 (click)
- JS中常见的字符串拼接处理
- js中函数参数拼接方法
- Js 拼接 dom Html
- js拼接HTML页面
- JS 中的 Html 拼接
- js中拼接字符串时,onclick顺序乱了不执行时间
- html中不用onclick一个函数,自动启动
- 在ArcGIS字段计算器中使用Python脚本将Text类型转换成整型
- java 死锁
- tensorflow,卷积神经网络与mnist
- verilog中的综合与不可综合
- 仿Select下拉框自动提示(easyui combobox插件实现)
- js中拼接html文档之onclick函数处理
- 文章标题 spring-cloud浅见
- SSM框架——Spring+SpringMVC+Mybatis的搭建教程 一:概述 SSM框架在项目开发中经常使用到,相比于SSH框架,它在仅几年的开发中运用的更加广泛。 Spring作为一个轻量级
- Eclipse安装git插件
- 设计模式の单例模式
- NLP中的新词发现特征选择
- 解决VM克隆CentOS系统后eth0消失,显示eth1的问题
- Tomcat 部署项目后,访问出现404
- 小程序微信支付申请