当前位置:Gxlcms > JavaScript > js onclick事件传参讲解

js onclick事件传参讲解

时间:2021-07-01 10:21:17 帮助过:5人阅读

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事件

人气教程排行