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

Here , the Latest version of firefox and chrome shows below error message :-

TypeError: document.thisJSP is undefined

Where .thisJSP is my Form Name ...

Thnx in advance.

Here is my Form

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

8
  • 1
    Please provide full code which allows us to reproduce your issue. Commented May 5, 2018 at 6:12
  • Are DOM elements supposed to be accessible by name directly from document? Shouldn't you use document.getElementsByName to get to the elements? Commented May 5, 2018 at 6:14
  • @HiddenHobbes Please find the javascript below and the input tag from which this onclick event gets call...!!! <input type="button" name="chkSelectAll" value="Check All" onclick="javascript:selectAllCheckBox(this,document.thisJSP.chkUser);"> Commented May 5, 2018 at 6:19
  • place your code here, specially where you define your form class or object. maybe it's because new JavaScript class definition. Commented May 5, 2018 at 6:22
  • 1
    FYI, you don't need to put javascript: at the beginning of onclick attributes. That's only needed when you put JS in a URL. Commented May 5, 2018 at 6:22

2 Answers 2

0

document.forms['thisJSP'].elements['chkUser']

See https://stackoverflow.com/a/16732108/2079345 and https://developer.mozilla.org/en-US/docs/Web/API/Document/forms

Sign up to request clarification or add additional context in comments.

Comments

0

AFAK, your code is so UGLY!

Here is some suggestions:

  1. separate your ui definition and it's logic by define a new function;
  2. Use document.getElementById() function to reach the DOM element, not by name;
  3. You should try jQuery.

1 Comment

Thanks fro your advice but if you can provide example that can rellate my code then it would appreciated as m not in more touch with jQuery.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.