获取checkbox中所有选中值及input后面所跟的文本,,返回为数组
Code
function check(chkInstance){
var arrChk = [];
for(i=0;i<chkInstance.length;i++){
if(chkInstance[i].checked==true){
arrChk[i] = chkInstance[i].nextSibling.nodeValue + "|" + chkInstance[i].value;
}
}
return arrChk;
}
//eg
check(document.forms[0].Header);获取选中的radiobox项的值
Code
function radio_active(radio_group) {
// Run through the group
for (counter = 0; counter < radio_group.length; counter++) {
// When we find the activated button, return the index
if (radio_group[counter].checked) {
return counter
}
}
// If no button is activated, return -1
return -1
}
function display_radio_value(current_form) {
// Get the index of the activated button
var radio_index = radio_active(current_form.freight_group)
// If a button is activated, display its value in the text box
if (radio_index >= 0) {
current_form.selected_radio.value = current_form.freight_group[radio_index].value
}
}
function check(chkInstance){
var arrChk = [];
for(i=0;i<chkInstance.length;i++){
if(chkInstance[i].checked==true){
arrChk[i] = chkInstance[i].nextSibling.nodeValue + "|" + chkInstance[i].value;
}
}
return arrChk;
}
//eg
check(document.forms[0].Header);
function radio_active(radio_group) {
// Run through the group
for (counter = 0; counter < radio_group.length; counter++) {
// When we find the activated button, return the index
if (radio_group[counter].checked) {
return counter
}
}
// If no button is activated, return -1
return -1
}
function display_radio_value(current_form) {
// Get the index of the activated button
var radio_index = radio_active(current_form.freight_group)
// If a button is activated, display its value in the text box
if (radio_index >= 0) {
current_form.selected_radio.value = current_form.freight_group[radio_index].value
}
}