js onclick事件传参讲解

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

js onclick事件传参讲解

  2020-05-13 我要评论

1、在页面中给方法传参数有两种方法

第一:onclick=cancel(id,patientId);

在js文件中定义cancel方法

如果要把当前对象传过去用onclick="cancel(this,id,patientId)"

js中cancel(obj,id,patientId)

第二:在js中用jquery$(function(){

var patientId=$("a").attr("patientId");

}),在页面中<tr patientId="${patientId}">

2、onclick事件

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们