首页 > Web开发 > 详细

html页面调用js方法时的两种传参方式

时间:2020-01-13 21:13:47      阅读:98      评论:0      收藏:0      [点我收藏+]
<tbody th:if="${pageInfo?.list}">
<tr th:each="groupList,loopStatus : ${pageInfo?.list}">
<td id=‘number0‘ th:if="${flag}==0" th:each="group,loopStatus : ${groupList}" >
<label th:text="${group?.phoneNo}"></label>
<a id=‘edit0‘ href="javaScript:void(0);"
th:data-phoneId="${group?.Id}"
th:data-dataUserId="${group?.dataUserId}"
th:onclick="groupAdd.showModify([[${group.phoneNo}]],this.getAttribute(‘data-phoneId‘),this.getAttribute(‘data-dataUserId‘))">
编辑
</a>
<a id=‘delete0‘ href="javaScript:void(0);"
th:data-phoneId="${group?.Id}"
th:data-dataUserId="${group?.dataUserId}"
th:onclick="groupAdd.deletePhone([[${group.phoneNo}]],this.getAttribute(‘data-phoneId‘),this.getAttribute(‘data-dataUserId‘))">
删除
</a>
</td>
  </tr>
</tbody>

1.有th标签时,可以用this.getAttribute(‘data-phoneId‘)方式,其中data-phoneId为页面经过th定义的参数;
2.不用th标签时,可以用[[${group.phoneNo}]]方式,通过双重中括号,直接获取group对象里的phoneNo.


html页面调用js方法时的两种传参方式

原文:https://www.cnblogs.com/xuhk1819/p/12189138.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!