Reset Text Boxes in Java

Is there any reset function in java

Page 1 of 1

1 Replies - 2411 Views - Last Post: 13 January 2010 - 01:26 PM

#1 refhat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 01-December 09

Reset Text Boxes in Java

Post icon  Posted 13 January 2010 - 12:40 PM

I hace created a dummy web page with three text boxes and three buttons, Enable Disable abd Reset. The enable disable buttons work as expected but the Reset button does not. can anyone point me where I am going wrong in my code:

Thanks:
<html>
<head>
<script type="text/javascript">
function clear()
  {
	document.getElementById("myForm").reset();
	
  }
function disable()
  {
   document.getElementById('txt1').disabled=true;
   document.getElementById('txt2').disabled=true;
   document.getElementById('txt3').disabled=true;
  }
function enable()
  {
  document.getElementById('txt1').disabled=false;
  document.getElementById('txt2').disabled=false;
  document.getElementById('txt3').disabled=false;
  }

</script>
</head>
<body>
<table>
<form id = "myForm">
 First Name<input type = "text1" id = "txt1"  size = "20"><br><br>
 Last Name<input type = "text2" id = "txt2" size = "20"> <br><br>
 Contact Number<input type = "number" id = "txt3" size = "15"><br><br>
 <input type="button" onclick="disable()" value="Disable" />
<input type="button" onclick="enable()" value="Enable" />
<input type = "button" onclick="clear()" value = "Reset">
</form></table>
</body>


Is This A Good Question/Topic? 0
  • +

Replies To: Reset Text Boxes in Java

#2 przemass  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 166
  • Joined: 18-July 09

Re: Reset Text Boxes in Java

Posted 13 January 2010 - 01:26 PM

Clear is reserved word in javascript, use different function name.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1