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

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

The "onsubmit" should be in the <form> tag - try that. If you want to catch the enter key being hit in a text field, you should use a function that checks the key being pressed on keyup/keydown, such as:

function enterKeyHit (e)
    {
    if (e && e.keyCode == 13)
        {
        return true;
        }
    else
        {
        return false;
        }
    }

<input type="text" name="rowsPerPage" id="rowsPerPage" value="20" onkeyup="if (enterKeyHit(event)) {setHw();}"/>
Member Avatar for rajarajan2017
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="javascript">
function showDiv(e) {
	var unicode=e.keyCode? e.keyCode : e.charCode
	if (unicode==13){
		//your code
	}
}
</script>
</head>

<body>
<body onkeypress="showDiv(event)">
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.