readonly attribute

Used By:input

The readonly attribute can be set on any form field to prevent it interacting with the user. No mouse events are registered on the item, although the onotherchange attribute can be set to allow the value to change when other fields are entered, and of course the value can be altered via JavaScript.

This shows three fields, with the third one being the result of some total of the first two.

<input type="text" name="field1"/>
<input type="text" name="field2"/>
<input type="text" readonly="true" onOtherChange="javascript:calculateTotal(field1, field2)"/>