<table>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<button type="button" onclick="Authority(${p.permissionId},${role.roleId},this)" class="btn btn-warning btn-sm">授权</button>
</td>
</tr>
</table>
2.js代码
/* 授权 */
function Authority(permissionId,roleId,obj){
var tr1 = obj.parentNode.parentNode; //获取当前对象的父节点的父节点(也就是tr)
//alert(tr1.rowIndex);
//alert(tr1.cells[0].innerText);
//alert(tr1.cells[3].innerHTML);
tr1.cells[3].innerHTML="<span class='text-success'>已授权</span>"; //对第4个的td赋值(下标从0开始)
tr1.cells[4].innerHTML="<button type='button' onclick='revokeAuthority("+permissionId+","+roleId+",this)' class='btn btn-warning btn-sm'>取消授权 </button>";
//alert(roleId+" "+permissionId);
}