循环
<table>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>备注</th>
</tr>
<tr>
<td>张三</td>
<td>23</td>
<td><a href="javascript:;" onclick="show_re(这里是一个动态ID)">查看<a></td>
</tr>
<tr id="action_list这里是一个动态ID" style="display:none">
<td colspan="3">
<table>
<tr>备注一</tr>
<table>
</td>
</tr>
</table>
function cs_show_re(orderId){
var ac_list = document.getElementById("action_list"+orderId);
if (ac_list.style.display != "block") {
ac_list.style.display = "block";
} else {
ac_list.style.display = "none";
}
}循环结束
请问大家,为什么我显示点击 查看 之后,备注里的td单元格就不合并了啊?
如图:
<table>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>备注</th>
</tr>
<tr>
<td>张三</td>
<td>23</td>
<td><a href="javascript:;" onclick="show_re(这里是一个动态ID)">查看<a></td>
</tr>
<tr id="action_list这里是一个动态ID" style="display:none">
<td colspan="3">
<table>
<tr>备注一</tr>
<table>
</td>
</tr>
</table>
function cs_show_re(orderId){
var ac_list = document.getElementById("action_list"+orderId);
if (ac_list.style.display != "block") {
ac_list.style.display = "block";
} else {
ac_list.style.display = "none";
}
}循环结束
请问大家,为什么我显示点击 查看 之后,备注里的td单元格就不合并了啊?
如图:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">
function cs_show_re(){
var ac_list = document.getElementById("action_list"); if (ac_list.style.display != "block") {
ac_list.style.display = "block";
} else {
ac_list.style.display = "none";
}
}
</script>
<body>
<div> <table>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>备注</th>
</tr>
<tr>
<td>张三</td>
<td>23</td>
<td><a href="javascript:void(0);" onclick="cs_show_re()">查看</a></td>
</tr>
<tr id="action_list" style="display:none">
<td colspan="3">
<table>
<tr style="background-color: red;"><td> 备注一fdsfdsfsdfdsfsdfsd</td></tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
你的javascript把<script type="text/javascript"></script>标签带着,
还有onclick事件的方法名和function的方法名不一致哦,
还有就是那个备注那块的html格式不标准,少个<td></td>