Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page reloading problem

Status
Not open for further replies.

DKL01

Programmer
Sep 14, 2000
233
US
Hi Guys,

I'm having strange problem here. With the below mentioned code if the enter some value in the text box and hit ENTER key the page is reloading automatically with query string. If I enter 323232 in the text field and hit enter the page reloads with url
temp5.asp?text1=323232. What could be the problem ? I don't want anything to happen if I press enter key. How to fix it ?

Thanks

temp5.asp

<%@ Language=VBScript %>


<script language=&quot;Javascript&quot;>


function validateData() {
if (document.form1.text1.value == &quot;&quot;) {
alert(&quot;Please enter Number.&quot;);
return;
}
document.form1.action=&quot;Validate.asp&quot;;
document.form1.method=&quot;post&quot;;
document.form1.submit();
}


</script>

<html>
<head> </head>
<body>


<form name=form1>

<table align=center>
<tr>
<td> Number </td>
<td> <input type=&quot;text&quot; maxlength=&quot;20&quot; size=30 name=&quot;text1&quot; id=&quot;text1&quot;> </td>
</tr>
</table>

<input type=&quot;button&quot; value=&quot;GO&quot; onclick=&quot;validateData()&quot; id=button1 name=button1>

</form>

</body>
</html>
 
You don't have any control over what happens when the enter key is pressed as far as I know. It is dependent on the browser, IE and Netscape both handle it differently. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top