View Single Post
Old 01-29-2013, 03:22 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,399
Thanks: 18
Thanked 352 Times in 351 Posts
sunfighter is on a distinguished road
Not pretty, but shows you what to do:
Code:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
Enter grams of fat:
<input type="text" id="fatin" onkeyup="document.getElementById('fat').value = document.getElementById('fatin').value/300;">
This is a changed fat thing: <input id="fat"><br />

Enter grams of sugar:
<input type="text" id="sugin" onkeyup="document.getElementById('sugar').value = document.getElementById('sugin').value/4;">
This is a changed sugar thing: <input id="sugar">
</body>
</html>
Did not check for numbers only.
sunfighter is offline   Reply With Quote