如何在 php 中单击多个复选框时调用 javascript 函数?
当我下载 excel 时,它不会获取选定的值。
<script>
function xls_fun()
{
alert('hi');
var code=document.getElementById('code').value;
var hpnm=document.getElementById('hpnm').value;
var d_add=document.getElementById('d_add').value;
document.getElementById('xls_link').href="createxls.php?fnm=mynewxls.xls&code="+code+"&hpnm="+hpnm+"&d_add="+d_add+"&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=100&width=150&modal=false";
}
</script>
<tr><th align="center">Code Number</th><th align="center">Name Of Hospital</th>
<th align="center">Doctor Address</th></tr>
<tr><td><?php echo $row1['code'];?></td><td><?php echo $row1['hname'];?></td>
<td><?php echo $row1['doc_add'];?></td></tr>
<tr><th align="center"><th align="center"><input type="checkbox" name="code" id="code" value="<?php echo $row1['code'];?>" onchange="xls_fun()"></th>
<th align="center"><input type="checkbox" name="hpnm" id="hpnm" value="<?php echo $row1['hname'];?>" onchange="xls_fun()"></th>
<th align="center"><input type="checkbox" name="d_add" id="d_add" value="<?php echo $row1['doc_add'];?>" onchange="xls_fun()"></th>