Source Code of: badcalculator.htm
Date Last Modified: May 02, 2009 - 01:59:19 AM
Size: 833 Bytes  |  40 lines  |  833 characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Troublesome Calculator</title>
<script type="text/javascript">
<!--

// horribly inefficient, but this is just a demo...
window.onload = function() {
    document.getElementById('calc').onclick = function() {
        document.getElementById('result').innerHTML = 
            parseFloat(document.getElementById('addend1').value) 
            +
            parseFloat(document.getElementById('addend2').value);
    };
};


// -->
</script>
</head>
<body>

<form>

<p>
<input type="text" name="addend1" id="addend1" value="1" />
+
<input type="text" name="addend2" id="addend2" value="2" />
=
<span id="result">3</span>
<input type="button" name="calc" id="calc" style="margin-left: 30px;" value="Calculate" />
</p>

</form>


</body>
</html>

A Derivative Work of: PHP Source Code Utility - Version 1.0.0 Copyright © 0php.com 2002.