, element.value];
}
},
textarea: function(element) {
return [element.name, element.value];
},
select: function(element) {
return this[element.type == ''select-one'' ?
''selectOne'' : ''selectMany''](element);
},
selectOne: function(element) {
var value = null, option, index = element.selectedIndex;
if(index >= 0) {
option = element.options[index];
value = option.value == (undefined || '''') ? option.text : option.value;
}
return [element.name, value];
},
selectMany: function(element) {
var value = [];
for(var i = 0; i < element.length; i++) {
var option = element.options[i];
if(option.selected) {
var optvalue = option.value == (undefined || '''') ? option.text : option.value;
value.push(optvalue);
}
}
return [element.name, value];
}
};
function $F(element) {
this.form = element;
}
Object.extend($F.prototype, Form);
/**************************************************************
* 测试函数
*/
function onTest() {
//get提交方法
var params = new Object();
params.ss = ''张三'';
new ajax.request(''ajax.do?method=doGet'', {
onSuccess: function(transport) {
alert(transport.evalJSON().xx)
},
parameters: params
});
//post form提交方法
var params = new Object();
params.idd = 1000;
params.names = ''张三''
new $F(''form'').request({
onSuccess: function(transport) {
alert(transport.evalJSON().xx);
},
parameters: params
});
}