zoukankan      html  css  js  c++  java
  • 选中列表值

    function InitData(depth,parent,id)
    {
        var ele = document.getElementById(id);
        if(depth==1)
        {
            for(var i=0;i<firstSort.length;i++)
            {
            if(firstSort[i][0]==parent)
            ele.options.add(new Option(firstSort[i][2],firstSort[i][1]));
            }
        }
        else if(depth==2)
        {
            ele.options.length=0;
            for(var i=0;i<secondSort.length;i++)
            {
            if(secondSort[i][0]==parent)
            ele.options.add(new Option(secondSort[i][2],secondSort[i][1]));
            }
            ele.options.selectedIndex=0;
        }
        else if(depth==3)
        {
            ele.options.length=0;
            for(var i=0;i<thirdSort.length;i++)
            {
            if(thirdSort[i][0]==parent)
            ele.options.add(new Option(thirdSort[i][2],thirdSort[i][1]));
            }
            ele.options.selectedIndex=0;
        }
    }
    InitData("1","0","LbFirst");
    function secondSelect(first,second,third)
    {
        var tempSecIndex="";
        var tempThirIndex="";
        try{
         tempSecIndex = document.getElementById(first).options[document.getElementById(first).selectedIndex].value;
        }
        catch(e){
        tempSecIndex=0;
        }
        try{
         tempThirIndex = document.getElementById(second).options[document.getElementById(second).selectedIndex].value;
        }
        catch(e){
        tempThirIndex=0;
        }
        InitData("2",tempSecIndex,second);
        InitData("3",tempThirIndex,third);
    }
    function thirdSelect(parentId,selectId)
    {
        var tempSecIndex;
        try{
        tempSecIndex =  document.getElementById(parentId).options[document.getElementById(parentId).selectedIndex].value;
        }
        catch(e){
        tempSecIndex=0;
        }
        InitData("3",tempSecIndex,selectId)
    }
    function allsort()
    {
    var tempFir= document.getElementById("LbFirst").options[document.getElementById("LbFirst").selectedIndex].value;
    var tempSec= document.getElementById("LbSecond").options[document.getElementById("LbSecond").selectedIndex].value;
    alert(document.getElementById("LbThird").selectedIndex);
    var tempThir= document.getElementById("LbThird").selectedIndex>-1?(document.getElementById("LbThird").options[document.getElementById("LbThird").selectedIndex].value):(0);
    selectIndex("LbFirst",tempFir,"LbSecond",tempSec,"LbThird",tempThir);
    }
    function selectIndex(firId,firSort,secId,secSort,thirId,thirSort)
    {
        if(firSort.length>0){     
           listSelect(firId,firSort)
        }
        if(secSort.length>0){  
         secondSelect(firId,secId,thirId)  
           listSelect(secId,secSort)
        }
        if(thirSort.length>0){   
         thirdSelect(secId,thirId) 
           listSelect(thirId,thirSort)
        }
    }
    function listSelect(lId,lSort)
    {
     var firSortEle = document.getElementById(lId).options;
           for(var i=0;i<firSortEle.length;i++){
          if(firSortEle[i].value==lSort){
          firSortEle[i].selected=true;
          break;
          }   
         }
    }
    selectIndex("LbFirst","6A726A","LbSecond","47E3B5","LbThird","19F5F1");
  • 相关阅读:
    DVWA 黑客攻防演练(十)反射型 XSS 攻击 Reflected Cross Site Scripting
    DVWA 黑客攻防演练(九) SQL 盲注 SQL Injection (Blind)
    DVWA 黑客攻防演练(八)SQL 注入 SQL Injection
    DVWA 黑客攻防演练(七)Weak Session IDs
    DVWA 黑客攻防演练(六)不安全的验证码 Insecure CAPTCHA
    DVWA 黑客攻防演练(五)文件上传漏洞 File Upload
    工作流表结构设计
    Visual Studio 2019尝鲜----新建空项目体验
    《使用CSLA 2019:CSLA .NET概述》原版和机译文档下载
    .NET快速开发平台的在线预览
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835715.html
Copyright © 2011-2022 走看看