Guess this is javascript.

Similar as in excel, (I have seen this before), lets say I have 3 fields in a form.

Now when entering a numeric value in field 1, and lets say field 2 has the value of 5, then the value of field 1 times field 2 has to display in filed 3.

Please if anyone could assist me with this.

Also, similar to a popup calendar where one can select a date and once selected, the date automatically displays in the text field, how is it possible to have a custom popup page with pre-defined values, and ince a value in the popup are selected, its displayed in the field of the parent page.



<input type="text" id="field1">
<input type="text" id="field2" ><br>
<input type="text" id="ans" onfocus="document.getElementById('ans').value=document.getElementById('field1').value*document.getElementById('field2').value" >


When you Click on the 3rd field, it will display the answer i.e. the product of the first field and second field.
I hope this is what you wanted.
Have a nice day!! :)

this is very nice but the problem is that if you need to add up fields, let's say field1 + field2
when field1=3 and field2=4 the total is 34 instead of 3+4="7"

it works on multiplication, but not addition. such a simple script i wished it worked better

i need (field1field2/100)+field1
result= 105
but it is giving

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.