﻿// JScript文件
//百韵科技 http://www.cnbaiyun.com 
//CopyRight 2005-5-18
//若使用此文件，请不要删除版权


//交换背景方式一
function ChanageBgColor(aColor,bColor){
var chkLength = document.getElementsByName("ChkSingle").length;

    for(var i = 0;i < chkLength; ++ i) 
    { 
　　     if(document.getElementsByName("ChkSingle")[i].checked) 
　　     { 
　　        document.getElementById("GridView1").rows[i+1].style.backgroundColor=bColor; 
　　     } 
　　     else 
　　     { 
　　        if ((i%2)==0)
　　        {
　　        document.getElementById("GridView1").rows[i+1].style.backgroundColor="";
　　        }else
　　        {
　　        document.getElementById("GridView1").rows[i+1].style.backgroundColor=aColor;
　　        }
　　     }
    }
}
//全选择
function checkFormAll(tempControl)
{
var theBox=tempControl;
var xState=theBox.checked;
var elem=theBox.form.elements;
    for(var i=0;i<elem.length;i++)
    {
        if(elem[i].type=="checkbox")
        {
            elem[i].checked=xState;
        }
    }
}

//复选框验证
function ValidatorCheckFormAll(string)
{
    var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="checkbox")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==0)
    {
        alert("请选择要"+string);
        return false;
    }
}

//单选框验证
function ValidatorCheckFormAllRadio(string)
{
    var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="radio")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==0)
    {
        alert("请选择要"+string);
        return false;
    }
    return true;
}
