I have 2 text boxes A and B I want the answer A-B displayed on A Text box 'onchange' event of B
Please help me
God Bless


first, please try with some code then post your code here for help.
Anyway try with example script:

function test()
var x=document.getElementById("A");

Use this test() on'onchange' for A text box.

Please post your required peice of code..
All the best.

Member Avatar

Why is this php?

I think this code will help you .:-)

  <TITLE>Test Input</TITLE>
  <SCRIPT LANGUAGE="JavaScript">
  function validate (form) {
   var First = form.inputbox.value;
   var Sec = form.inputbox2.value;
   alert( " Result = " +First+ "-" +Sec);
   document.getElementById("nm").value=First+ "-" +Sec;
  <FORM NAME="myform" ACTION="" METHOD="GET">Enter something in the box: <BR>
 First Name <INPUT id ="nm" TYPE="text" NAME="inputbox" VALUE="" ><P>
 Second Name  <INPUT TYPE="text" NAME="inputbox2" VALUE="" OnChange="validate(this.form)" ><P>

It is Javascript problem. Move to Javascript forum.

Moving to Javascript.

document.getElementById("nm").value=First+ "-" +Sec line do no give the answer
it just shows the equation
ex: 500-400 answer should be 100 but it show as 500-400

Please help
God Bless


How do a equation on a formatted text box
EX: TextBox A = formatted(14,500.00) Text box B - formatted(1,1200.00)
TextBox A = 14,500.00 - 1,1200.00 answer comes as 'Nan'

Please help
God Bless