JS to mooTools friendly version.

Nov 07, 2007 15:59

I'm trying to convert this:
function multiShip(){
var qty = document.forms.cart.quantity.value;
if(qty > 1) {
document.forms.cart.shipMultiple.style.display="block"
return false;
}
else if(qty >=11 || qty <= 1) {
document.forms.cart.shipMultiple.style.display="none"
return false;
}
else return true;
}

to something like this:

window.addEvent('domready', function() {
var qty = $('quantity'), ship = $('shipMultiple');
});
$('quantity').addEvents({
'keyup': function() {
if (qty.value.contains('> 1')) qty.fireEvent('show', 'block');
else if (qty.value.contains('<= 1')) qty.fireEvent('show'), '');
else if (qty.value.contains('> 10')) qty.fireEvent('show'), '');
},
'show': function(display) {
ship.style.display='';
ship.style.display='block';
});
});

without returning this:
missing ; before statement line 26 (this line below):
else if (qty.value.contains('<= 1')) qty.fireEvent('show'), '');
Previous post Next post
Up