www.webdeveloper.com
Results 1 to 3 of 3

Thread: javascript not called by pressing return key

  1. #1
    Join Date
    Feb 2010
    Posts
    33

    javascript not called by pressing return key

    My javascript function setHw is not called by pressing the return key in all of the following pages.
    Please help.

    Code:
    <div id="rowPerPageDiv">
    <form name="tagform" action="Hw.htm" method="post">
      <input type="hidden" name="currPage" value="0"/>
      Rows Per Page<input type="text" name="rowsPerPage" id="rowsPerPage" value="20" onsubmit="return setHw()"/>
      <input type="button" value="Apply" onClick="setHw()"><br>
    </form>
    </div>
    Code:
    <div id="rowPerPageDiv">
    <form name="tagform">
      <input type="hidden" name="currPage" value="0"/>
      Rows Per Page<input type="text" name="rowsPerPage" id="rowsPerPage" value="20" onsubmit="return setHw()"/>
      <input type="button" value="Apply" onClick="setHw()"><br>
    </form>
    </div>

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    onsubmit needs to be in the form tag.
    If the action is to do nothing but run the function, the return must be false

  3. #3
    Join Date
    Mar 2010
    Posts
    2,803
    maybe this will work better:

    Code:
    <div id="rowPerPageDiv">
    <form name="tagform" action="Hw.htm" method="post"  onsubmit="return setHw()"  >
      <input type="hidden" name="currPage" value="0"/>
      Rows Per Page<input type="text" name="rowsPerPage" id="rowsPerPage" value="20" />
      <input type="submit" value="Apply" /><br>
    </form>
    </div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles