使用javascript

时间:2018-05-05 06:06:34

标签: javascript html forms html-table event-handling

onclick="javascript:selectAllCheckBox(this,document.thisJSP.chkUser);"

此处,最新版本的firefox和chrome显示以下错误消息: -

  

TypeError:document.thisJSP未定义

其中.thisJSP是我的表格名称......

Thnx提前。

这是我的表格

<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>

2 个答案:

答案 0 :(得分:0)

AFAK,您的代码非常简洁!

以下是一些建议:

  1. 通过定义新功能来区分你的ui定义及其逻辑;
  2. 使用document.getElementById()函数来访问DOM元素,而不是按名称;
  3. 你应该尝试jQuery。

答案 1 :(得分:0)