Jump to content

Handle a input box by javascript


Namal
 Share

Recommended Posts

There is a function call "myvalue()" in my external javascript file. (tst.js)There are button call " Test" and input textbox call (ID) "txttotal" in my HTML file.I want to do following:Click on the "Test" button, The "txttotal" value will be "10"How can I do that?... Please explain that soon.

Link to comment
Share on other sites

<html><head>  <title></title>  <script>	function myvalue()	{	  var textbox = document.getElementById('txttotal');	  textbox.value = 10;	}  </script></head><body>  <form id="form1">	<input type="text" id="txttotal" value=""/><br/>	<input type="button" id="btntest" value="Test" onclick="myvalue()"/>  </form></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...