查找所有<li>

时间:2018-05-26 07:31:15

标签: javascript styles element

对不起,我刚刚开始使用JS,实际上我并不理解

我想找到李白边境的所有颜色

HTML:

  <li><a href="#"><i class="fas fa-home"></i></a></li>
  <li><a href="#"><i class="fas fa-user"></i></a></li>
  <li><a href="#"><i class="fas fa-briefcase"></i></a></li>
  <li><a href="#"><i class="far fa-images"></i></a></li>
  <li><a href="#"><i class="fas fa-envelope"></i></a></li>

SCSS:

  li {
    height: 20%;
    width: 100%;
    list-style: none;
    text-align: center;
    &:nth-child(1) {
      border-right: 6px solid #2196F3;
    }
    &:nth-child(2) {
      border-right: 6px solid #00BCD4;
    }
    &:nth-child(3) {
      border-right: 6px solid #4CAF50;
    }
    &:nth-child(4) {
      border-right: 6px solid #FFC107;
    }
    &:nth-child(5) {
      border-right: 6px solid #FF5722;
      border-bottom: none;
    }
    a {
      color: $white;
      line-height: 20vh;
    }
  }

我试过这个,但我得到了未定义的

let icons = document.querySelectorAll('li');
console.log(icons.style.borderColor);

抱歉这个noob问题。感谢帮助 ! 祝你有个美好的一天:)

1 个答案:

答案 0 :(得分:1)

首先,您将获得select ID, SEQ, CODE, case when LAST_VALUE(decode(code,'+','+','-','-') ignore nulls) over (partition by id order by seq ) = '+' then SUM(decode(code,'+',1,0)) over (partition by id order by seq) else SUM(decode(code,'+',1,'-',-1,0)) over (partition by id order by seq) end as last_idx from tab order by id, seq; 变量中的元素列表。你必须遍历它才能找到每个元素的边框颜色。

create table tab as
select 1 id, 1 seq, '+' code from dual union all
select 1 id,2 seq, '=' code from dual union all
select 1 id,3 seq, '=' code from dual union all
select 1 id,4 seq, '+' code from dual union all
select 1 id,5 seq, '=' code from dual union all
select 1 id,6 seq, '-' code from dual union all
select 1 id,7 seq, '=' code from dual union all
select 1 id,8 seq, '+' code from dual union all
select 1 id,9 seq, '=' code from dual union all
select 1 id,10 seq, '-' code from dual  union all
select 2 id, 1 seq, '+' code from dual;