//根据值选中下拉菜单某项
function setSelectedValue(id,value){
var selectObj = document.getElementById(id);
for(i=0;i<selectObj.length;i++){
if(selectObj.options[i].value==value){
selectObj.options[i].selected = "selected";
}
}
}
//获取下拉菜单当前选择的值
function getSelectedValue(id){
var value = document.getElementById(id).value;
return value;
}
//根据值选择多个下拉选项
function setSelectedValues(id,values){
var selectObj = document.getElementById(id);
for(var i=0;i<values.length;i++){
value = values.split(",");
for(var j = 0;j<value.length;j++){
for(var k = 0;k<selectObj.length;k++){
if(selectObj.options[k].value==value[j]){
selectObj.options[k].selected = "selected";
}
}
}
}
}
//获取下拉菜单当前选中的多个值
function getSelectedValues(id){
var selectObj = document.getElementById(id);
var values = "";
for(var i = 0;i<selectObj.length;i++){
if(selectObj.options[i].selected){
var value1 = selectObj.options[i].value;
var value = value1 + ",";
values += value;
}
}
return values;
}
//根据值选中某个单选框
function setCheckedRadio(name,value){
var checkObj = document.getElementsByName(name);
for(i=0;i<checkObj.length;i++){
if(checkObj[i].value==value){
checkObj[i].checked = "checked";
if(name=="dp"&&value==5){
document.getElementById('dp3con').style.display='none';
document.getElementById('dp5con').style.display='block';
}else if(name=="dp"&&value==3){
document.getElementById('dp3con').style.display='block';
document.getElementById('dp5con').style.display='none';
}
if(name=="MsPretight"){
chooseMOrF();
}
}
}
}
//获取当前选中的单选框的值
function getCheckedRadio(name){
var radioValue= "";
?? ? ? var radioObj=document.getElementsByName(name);
?? ? ? for(var i=0;i<radioObj.length;i++){
?? ? ? ? ? if(radioObj[i].checked==true){
?? ? ? ? ? ? ?radioValue= radioObj[i].value;
?? ? ? ? ? ? ?break;
?? ? ? ? ? }
?? ? ? }
?? ? ? return radioValue;
}
?
//根据flag选中某个复选框
function setCheckedBox(id,flag){
var checkedBoxObj = document.getElementById(id);
if(flag=="true"){
checkedBoxObj.checked = "checked";
if(id=="MpIsDensityEqv"){
document.getElementById("MpEqvMass").readOnly = false;
document.getElementById("MpEqvMass").style.backgroundColor="#F0F8FF";
}
}else if(flag=="false"){
checkedBoxObj.checked = false;
}
}
//判断某个复选框的是否被选中
function getCheckedBox(id){
var flag = false;
var checkedBoxObj = document.getElementById(id);
if(checkedBoxObj.checked){
flag = true;
}
return flag;
}