In this document we use an HTML form.

When this button is clicked,...

the method 'addm' is called,...

as indicated in the 'onclick' attribute.

getElementById is a preferred (DOM) method to find something within a document's hierarchy,...

provided it has an 'id' attribute value.

Distill a, possibly fractional, number from the string entry,...

same for the second box...

and store them, added, in the third text box.

When the user starts to type anything in one of the first two text fields,...

the method 'clr' is called, where the third field's content is erased.

This is due to the method's name being mentioned as 'onkeypress' value.

Clicking the second button also has the 'clr' method called, but here a reference to the button itself is passed, with the special keyword 'this'.

This can then be used to ascertain who made the call to 'clr'...

and make a system sound if it was the second button.

'Toolkit' is a genuine Java class, and script engines that can't deal with those, will throw an exception,...

that we intercept with a try-catch. More on that later.

========

'maxlength', always a good idea with entry fields.

Read only.