Javascript page change demo

Javascript can change parts of the page in response to user actions, without reloading the entire page.

Here, when focus leaves quantity, total is re-calculated. This is entirely client-side. The server is not involved. Try entering text that is not a number.

View Source to see how this is done.


Quantity: x Price: €4.22
Your name:
Total:

€0.00

 


JavaScript validate as you type




HTML5 input patterns

HTML5 introduces forms that in HTML and CSS alone can do input checking. No JS needed. e.g. This HTML form allows only integer numbers. Try it out. View source to see CSS and HTML.


Quantity: