// JavaScript Document
//本JS主要用于操作Form中各个组件。
//整理和编写:wangchunfa
//整理日期:2007-04-11
//对使用者的要求 :多为开源做贡献!觉得好,对你有就点点头!否则去跳楼!!!
/**
@ 函数功能:全选(或取消全选)Multiple Select
@ 变量描述 @status : false ,全部不全选;true ,全部全选;(注:一般用checkbox触发)
@ 变量描述 @selectID : Multiple Select 的ID(或者Name)属性的值
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function selectAllMultipleSelect(status,selectID){
var options = "";
options = document.getElementById(selectID).options;
for(var i=0;i<options.length;i++){
options[i].selected = status.checked;
}
}
/**
@ 函数功能:获得所有MultipleSelect 的值
@ 变量描述 @bool : false ,返回值字符串中单个MultipleSelectd的Option值不带有'';
true ,返回值字符串中单个CheckBox的值带有'' ;
默认值为false;
@ 变量描述 @cbname : MultipleSelect 的ID(或者Name)属性的值
@ 返回值 :字符串,bool = true格式为 'a','b','c';bool = false格式为 a,b,c
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function getMultipleSelectValue(selectID,bool){
var options = "";
options = document.getElementById(selectID).options;
bquotes=bool;
if (bquotes==null)
bquotes=false;
var value = "";
for(var i=0;i<options.length;i++){
if(options[i].selected){
if(value == ""){
value = options[i].value
}
else{
if(bool){
value = value + "','" + options[i].value;
}
else{
value = value + "," + options[i].value;
}
options[i].selected = status.checked;
}
}
}
if ((bquotes)&&(value!=""))
value="'"+value+"'";
return value;
}
/**
@ 函数功能:获取Radio的值
@ 变量描述 @rdName : Radio 的ID(或者Name)属性的值
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function getRadioValue(rdName)
{
var str
var a = document.getElementsByName(rdName);
for (var i=0; i<a.length; i++)
{
if (a[i].checked)
str = a[i].value;
}
return str;
}
/**
@ 函数功能:获得所有CheckBox 的值
@ 变量描述 @bool : false ,返回值字符串中单个CheckBox的值不带有'' ;
true ,返回值字符串中单个CheckBox的值带有'';
默认值为false;
@ 变量描述 @cbname : CheckBox 的ID(或者Name)属性的值
@ 返回值 :字符串,bool = true格式为 'a','b','c';bool = false格式为 a,b,c
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function getCheckBoxValue(cbname,bool) {
var value="";
bquotes=bool;
if (bquotes==null)
bquotes=false;
var a = document.getElementsByName(cbname);
for (var i=0; i<a.length; i++){
if (a[i].checked) {
if (value=="") {
value=a[i].value;
}
else {
if (bquotes) {
value=value+"','"+a[i].value;
}
else {
value=value+","+a[i].value;
}
}
}
}
if ((bquotes)&&(value!=""))
value="'"+value+"'";
return value;
}
/**
@ 函数功能:全选(或取消全选)checkbox
@ 变量描述 @status : false ,全部不全选;true ,全部全选;(注:一般用checkbox触发)
@ 变量描述 @cbname : checkbox 的ID(或者Name)属性的值
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function selectAllCheckbox(status,cbname) {
var a = document.getElementsByName(cbname);
for (var i=0; i<a.length; i++){
a[i].checked = status.checked;
}
}
/**
@ 函数功能:全选(或取消全选)checkbox,带有限制cehckbox组的起始和结束序号功能。
@ 变量描述 @status : false ,全部不全选;true ,全部全选;(注:一般用checkbox触发)
@ 变量描述 @cbname : checkbox 的ID(或者Name)属性的值
@ 变量描述 @beginIndex : checkbox 组的起始序号
@ 变量描述 @endIndex : checkbox 组的结束序号
@ 版本:V1.0
@ 最后修改日期:2007-04-11
**/
function selectAllCheckboxRestrict(status,cbname,beginIndex,endIndex) {
var a = document.getElementsByName(cbname);
for (var i=beginIndex; i<endIndex; i++){
a[i].checked = status.checked;
}
}