【发布时间】:2018-10-15 14:41:42
【问题描述】:
onclick="javascript:selectAllCheckBox(this,document.thisJSP.chkUser);"
在这里,最新版本的 firefox 和 chrome 显示以下错误消息:-
TypeError: document.thisJSP is undefined
.thisJSP 是我的表单名称...
提前谢谢。
这是我的表格
<form action="AjaxRightsMenu.jsp" name="thisJSP" method="POST">
<FieldSet>
<Legend vAlign="Top">
<Font color="green">User Details </Font>
</Legend>
<div vAlign="Top" style="overflow: scroll; height: 280px; max-height: 280px">
<input type="hidden" name="hdnScrollValue" value="<%=myController.scrollValue%>">
<Table Align="left" border="1" cellpadding="0" cellspacing="1" vAlign="Top" Width="100%">
<Thead>
<tr>
<th width="9%" class="unsortable">
<B><input type="button" name="chkSelectAll" value="Check All" onclick="javascript:selectAllCheckBox(this,document.thisJSP.chkUser);"></B>
</th>
<th align="left" Width="10%" colspan="1">Group Name</th>
<th align="left" Width="10%" colspan="1">Loc Name</th>
<th align="left" Width="10%" colspan="1">APP Name</th>
<th align="left" Width="10%" colspan="1">Menu Name</th>
<th align="left" Width="10%" colspan="1">View Rights</th>
<th align="left" Width="10%" colspan="1">Add Rights</th>
<th align="left" Width="10%" colspan="1">Edit Rights</th>
<th align="left" Width="10%" colspan="1">Del Rights</th>
<th align="left" Width="10%" colspan="1">Auth Rights</th>
</tr>
</Thead>
【问题讨论】:
-
请提供完整的代码,以便我们重现您的问题。
-
DOM 元素是否应该可以直接从文档中通过名称访问?你不应该使用document.getElementsByName 来获取元素吗?
-
@HiddenHobbes 请找到下面的 javascript 和调用此 onclick 事件的输入标记...!!!
-
把你的代码放在这里,特别是你定义你的表单类或对象的地方。也许是因为新的 JavaScript 类定义。
-
仅供参考,您不需要将
javascript:放在onclick属性的开头。仅当您将 JS 放入 URL 时才需要这样做。
标签: javascript html forms html-table event-handling