jsp中如何调用function
这段代码在dreamweaver中能出效果,可是在jsp中就不行了,为什么呀?
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="../css/left_css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function showsubmenu(sid) {
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none") {
eval("submenu" + sid + ".style.display=\"\";");
} else {
eval("submenu" + sid + ".style.display=\"none\";");
}
}
</script>
</head>
<body>
<table border="1" id="table1">
<tbody id="tbody1">
<tr id="tittle">
<td>
信息编号
</td>
<td>
主题
</td>
<td>
内容
</td>
<td>
时间
</td>
<td>
留言人
</td>
<td></td>
</tr>
<c:forEach var="m" items="${requestScope.list}">
<tr id=${m.message_id }>
<td>
${m.message_id }
</td>
<td>
${m.message_subject }
</td>
<td>
${m.message_text }
</td>
<td>
${m.publish_time }
</td>
<td>
${m.name }
</td>
<td><input type="button" value="回复" onclick="javascript:showsubmenu(2)" /></td>
</tr>
<tr id=${m.message_id }>
<td>
</td>
<td colspan="2">
<table id="table2">
<tbody id="tbody2">
<tr>
<td>
<input type="text" name="admin_text" id="admin_text" />
<input type="submit" name="submit" id="submit" value="提交" />
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
------解决方案--------------------估计是html上有多个相同id的元素导致执行错误
------解决方案--------------------
JScript code
<script type="text/javascript">
function showsubmenu(sid) {
whichEl = "submenu" + sid;
if (document.getElementById(whichEl).style.display == "none") {
document.getElementById(whichEl).style.display = "block";
} else {
document.getElementById(whichEl).style.display = "none";
}
}
</script>
------解决方案--------------------
都木有看到有submenu