Jump to content

how to add two number on the same page


ms_dos10

Recommended Posts

that my code can i add two number and get the result on the same page on text field . it'll work with sumbit button onsubmit or normal button onclick i don't know pllllllllzzzzzzzzzz help i know it normal question but what shall i do i try everything but not work anyone help me [/code]<html><head> <title></title><script type="text/javascript"> function add(a,:) { var a = document.frm.num1.value var b = document.frm.num2.value var result return result=parseint(a)+parseint(:) result = document.frm.result.value }</script></head><body><center><form name="frm" action="" method="post" onsubmit="return add()"><h5>Num One</h5><input type="text" name="num1" value=""><br> <h5>Num Two</h5><input type="text" name="num2" value=""><br><h5>Result</h5><input type="text" name="result" value=""><br><input type="submit" name="butt" value="Click Me To Add Two Number"></form></center></body><html>

[code]<html><head>		 <title></title><script type="text/javascript">	 function add(a,b)		{		 var a = document.frm.num1.value		 var b = document.frm.num2.value		 var result		  return result=parseint(a)+parseint(b)		  result = document.frm.result.value		}</script></head><body><center><form name="frm" action="" method="post" onsubmit="return add()"><h5>Num One</h5><input type="text" name="num1" value=""><br> <h5>Num Two</h5><input type="text" name="num2" value=""><br><h5>Result</h5><input type="text" name="result" value=""><br><input type="submit" name="butt" value="Click Me To Add Two Number"></form></center></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
×
×
  • Create New...