prototype中常用操作

1. radio,checkbox获取被选的值

$$('input[type="radio"][name="invoice[invoice_type]"]').each(function(i){

if( i.checked==true ){
invoicetype=i.value;
}

});  


2. 

if( $('need_invoice_checkbox').checked==true ){
$('invoice_box').show();
}else{
$('invoice_box').hide();
}


3. ajax

var newAJAX = new Ajax.Request(
url, {
method: 'post', 
//parameters: {'product_id': giftOption.product.id, 'rule_amount': giftOption.rule.min_amount, 'rule_priority': giftOption.rule.priority}, 
parameters: {}, 
onSuccess: function(response) {
checkout.setLoadWaiting(false);
$('super_invoice_content').update( response.responseText );
}.bind(this),

onFailure: function(response) {
}.bind(this),

onComplete: function(response) {
}.bind(this)
}
); 

你可能感兴趣的:(function,prototype,url,input,Parameters)