/*
* 根据分割符号 把值赋给 相应的CheckBox
* CheckBox名字
* 将要分割的值
* 分割符号
*/
function InitiCheckBox(chbName,strValue,strSplit)
{
var arrChb = document.getElementsByName(chbName);
if(strValue.indexOf(strSplit) > -1)
{
var arrValue = strValue.split(strSplit);
for(var j = 0; j < arrValue.length; j++)
{
for(var i = 0;i < arrChb.length;i++)
{
if(arrChb[i].value == arrValue[j])
{
arrChb[i].checked = true;
break;
}
}
}
}
else
{
for(var i = 0;i < arrChb.length;i++)
{
if(arrChb[i].value == strValue)
{
arrChb[i].checked = true;
break;
}
}
}
}
function getCheckBoxValue(chbName)
{
var strTemp = "";
var cbx = document.getElementsByName(chbName);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].checked == true)
{
strTemp += cbx[i].value +"|";
}
}
if(strTemp != "")
{
strTemp = strTemp.substr(0,strTemp.length-1);
}
return strTemp;
}
/*
* 是否 有CheckBox 被选择
*/
function isCheckBoxSelected(name)
{
var t = false;
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].checked == true)
{
t = true;
break;
}
}
return t;
}
/*
* 不选CheckBox
*/
function unALLCheckBoxSelected(name)
{
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
cbx[i].checked = false
}
/*
* 是否 有CheckBox 被选择
*/
function SelectedCheckBox(name,bSelect)
{
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].disabled == false)
cbx[i].checked = bSelect;
}
}
/*
* 得到Select类型的Text 是否为空
*
*/
function getSelectText(id)
{
var obj = document.getElementById(id);
var temp = '';
temp = obj.options[obj.selectedIndex].text;
return temp;
}
function InitiSelect(obj,strValue)
{
for(var i = 0; i < obj.options.length; i ++)
{
if(obj.options[i].value == strValue)
{
obj.options[i].selected = true;
break;
}
}
}
function getRadioValueByName(name)
{
var rvs = document.getElementsByName(name);
var strETD = "";
for(var i=0; i < rvs.length; i++)
{
if(rvs[i].checked == true)
{
strETD = rvs[i].value;
break;
}
}
return strETD;
}
function InitiRadioByName(name,strValue)
{
var arrRadio = document.getElementsByName(name);
for(var i = 0; i < arrRadio.length; i ++)
{
if(arrRadio[i].value == strValue)
{
arrRadio[i].checked = true;
break;
}
}
}
function noSelectRadioByName(name)
{
var arrRadio = document.getElementsByName(name);
for(var i = 0; i < arrRadio.length; i ++)
arrRadio[i].checked = false;
}
function getLinkStrBySplitCode(arr,splitCode)
{
var strTemp = "";
if(arr && arr.length == 1)
strTemp = arr[0];
else if(arr && arr.length>1){
for(var i = 0; i < arr.length; i++)
strTemp += arr[i]+splitCode;
strTemp = strTemp.substr(0,strTemp.length-1);
}
return strTemp;
}
* 根据分割符号 把值赋给 相应的CheckBox
* CheckBox名字
* 将要分割的值
* 分割符号
*/
function InitiCheckBox(chbName,strValue,strSplit)
{
var arrChb = document.getElementsByName(chbName);
if(strValue.indexOf(strSplit) > -1)
{
var arrValue = strValue.split(strSplit);
for(var j = 0; j < arrValue.length; j++)
{
for(var i = 0;i < arrChb.length;i++)
{
if(arrChb[i].value == arrValue[j])
{
arrChb[i].checked = true;
break;
}
}
}
}
else
{
for(var i = 0;i < arrChb.length;i++)
{
if(arrChb[i].value == strValue)
{
arrChb[i].checked = true;
break;
}
}
}
}
function getCheckBoxValue(chbName)
{
var strTemp = "";
var cbx = document.getElementsByName(chbName);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].checked == true)
{
strTemp += cbx[i].value +"|";
}
}
if(strTemp != "")
{
strTemp = strTemp.substr(0,strTemp.length-1);
}
return strTemp;
}
/*
* 是否 有CheckBox 被选择
*/
function isCheckBoxSelected(name)
{
var t = false;
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].checked == true)
{
t = true;
break;
}
}
return t;
}
/*
* 不选CheckBox
*/
function unALLCheckBoxSelected(name)
{
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
cbx[i].checked = false
}
/*
* 是否 有CheckBox 被选择
*/
function SelectedCheckBox(name,bSelect)
{
var cbx = document.getElementsByName(name);
for(var i=0; i < cbx.length; i++)
{
if(cbx[i].disabled == false)
cbx[i].checked = bSelect;
}
}
/*
* 得到Select类型的Text 是否为空
*
*/
function getSelectText(id)
{
var obj = document.getElementById(id);
var temp = '';
temp = obj.options[obj.selectedIndex].text;
return temp;
}
function InitiSelect(obj,strValue)
{
for(var i = 0; i < obj.options.length; i ++)
{
if(obj.options[i].value == strValue)
{
obj.options[i].selected = true;
break;
}
}
}
function getRadioValueByName(name)
{
var rvs = document.getElementsByName(name);
var strETD = "";
for(var i=0; i < rvs.length; i++)
{
if(rvs[i].checked == true)
{
strETD = rvs[i].value;
break;
}
}
return strETD;
}
function InitiRadioByName(name,strValue)
{
var arrRadio = document.getElementsByName(name);
for(var i = 0; i < arrRadio.length; i ++)
{
if(arrRadio[i].value == strValue)
{
arrRadio[i].checked = true;
break;
}
}
}
function noSelectRadioByName(name)
{
var arrRadio = document.getElementsByName(name);
for(var i = 0; i < arrRadio.length; i ++)
arrRadio[i].checked = false;
}
function getLinkStrBySplitCode(arr,splitCode)
{
var strTemp = "";
if(arr && arr.length == 1)
strTemp = arr[0];
else if(arr && arr.length>1){
for(var i = 0; i < arr.length; i++)
strTemp += arr[i]+splitCode;
strTemp = strTemp.substr(0,strTemp.length-1);
}
return strTemp;
}