Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created February 16, 2013 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/4968832 to your computer and use it in GitHub Desktop.
Save walterdavis/4968832 to your computer and use it in GitHub Desktop.
// 'message' should be changed to match the name of your output box
var display = $('message').down('p').update();
new Form.Observer(document.forms[0], 0.3, function(form, value){
var vals = value.parseQuery(), message = '';
var amt = parseInt(vals.x, 10) * parseInt(vals.y, 10) * parseInt(vals.material, 10);
if(amt > 0){
message = (amt / 100).toFixed(2);
}
display.update(message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment