Prev Demo
JavaScript
>
Decrement
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <h1>Decrement by one</h1> <script type="text/javascript"> function Decrement() { var a = parseInt(document.getElementById("txtA").value); a--; alert(a); } </script> Enter two digit: <input type="text" id="txtA" name="txtA" /> <input type="button" name="btnDecrement" value="Submit" onclick="Decrement()" /> </body> </html>
Note: We DO NOT save your trial code in our database.
Output