﻿//供应信息Supply首页Index的 JScript文件

 function Opendiv(id)
{
    var obj_01 = document.getElementById("divNr1");
    obj_01.style.display = 'none';

    var obj_02 = document.getElementById("divNr2");
    obj_02.style.display = 'none';

    var obj_03 = document.getElementById("divNr3");
    obj_03.style.display = 'none';

    var obj_04 = document.getElementById("divNr4");
    obj_04.style.display = 'none';
 
    var obj = document.getElementById(id);
    obj.style.display = 'block';
}
    
    
 //Supply的首页中搜索条件的表单的提交链接   
 function toSubmit()
 {
    var supplyUrl="index.aspx?";
    //获取关键字（清除空格）
    var key=document.getElementById('keyWord').value.replace(/(^\s*)|(\s*$)/g, "");
    var yijuItem=document.getElementsByName('rtnYiJu');
    
    supplyUrl=supplyUrl+"key="+key;
    for(var m=0;m<yijuItem.length;m++)
    {
       if(yijuItem[m].checked==true)//getElementsByName比...ById多个s，他返回的是个集合，所有用[]数组模式取值，也可用'.item(1,null).value'获取
       {
            supplyUrl=supplyUrl+"&yj="+yijuItem[m].value;
       }
    }
    
    if(key!="输入药品名称或医药企业")
        location.href=supplyUrl;
    else
    {
        alert('请在文本框内输入您要搜索的产品名或企业名');
        document.getElementById('keyWord').focus();
    }
 }
     
     
//设置文本框选中
function txtSelect(txtID)
{
    var txtValue=document.getElementById(txtID).value.replace(/(^\s*)|(\s*$)/g, "");
    if(txtValue=="输入药品名称或医药企业" || txtValue=="")
    {
        document.getElementById(txtID).value="";
    }
}


//文本框失去焦点时，设置
function txtOutSelect(txtID)
{
    var txtValue=document.getElementById(txtID).value.replace(/(^\s*)|(\s*$)/g, "");
    if(txtValue=="" || txtValue=="输入药品名称或医药企业" )
    {
        document.getElementById(txtID).value="输入药品名称或医药企业";
    }
}