Parse Float example 1

by aaronk85

HTML

<html>
<head>

<script type="text/javascript">    
    function myAdd(tb1,tb2)
    {
    var x = parseFloat (tb1);
    var y = parseFloat (tb2);
    return (x+y);
    }
</script>
</head>
<body> 
<form action=""> 
tb1: <input type="text" name="tb1"><br/> 
tb2: <input type="text" name="tb2"><br/> 
tb3: <input type="text" name="tb3" value="2"><br/> 
<input type="button" name="b1" value="GO!" onClick ="tb3.value = myAdd(tb1.value, tb2.value)";><br />
</form> 
</body>
</html>