有关javascript 获取checkBox复选框的实例数不胜数。 js实现:
var field = form.elements["test2"];
var option = Dining.getSelectedOption(form,field);
var message = "";
for (var i = 0,len = option.length; i < len; i++) {
message += "Select id:" + option[i].id + "\nSelected name:" + option[i].name + "\nSelected value:" + option[i].value + "\n\n";
}
alert(message);
/获取选中的选项/
getSelectedOption: function (selectform,selectionfield) {
var result = [];
var option = null;
for (var i = 0; i < selectionfield.length; i++) {
option = selectionfield[i];
if (option.checked) {
result.push(option);
} www.jb51.cc
原文链接:https://www.f2er.com/js/57993.htmlvar option = Dining.getSelectedOption(form,field);
var message = "";
for (var i = 0,len = option.length; i < len; i++) {
message += "Select id:" + option[i].id + "\nSelected name:" + option[i].name + "\nSelected value:" + option[i].value + "\n\n";
}
alert(message);
/获取选中的选项/
getSelectedOption: function (selectform,selectionfield) {
var result = [];
var option = null;
for (var i = 0; i < selectionfield.length; i++) {
option = selectionfield[i];
if (option.checked) {
result.push(option);
} www.jb51.cc
}
return result;
}
",