php页面中,
原代码如下:
   <div>
   <input name="lp" type="checkbox" style="margin-bottom:-1px;" value="1"> a  
   </div>
   <div>
   <input name="esf" type="checkbox" style="margin-bottom:-1px;" value="1"> b  
   </div>
   <div>
   <input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="1"> 1    
   <input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2"> 2     
   </div>刚进页面时,最后一排的条件是不可用的,复选框和文字都要为灰色,点击了上面的a和b中的任何一项后,这一排变为可用
这如何实现呀,thanks

解决方案 »

  1.   

      <div>
      <input name="lp" type="checkbox" style="margin-bottom:-1px;" value="1"> a   
      </div>
      <div>
      <input name="esf" type="checkbox" style="margin-bottom:-1px;" value="1"> b   
      </div>
      <div>
      <input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="1" disabled> 1   
      <input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" disabled> 2   
      </div>
    根据你要的条件决定是不是要加disable属性
      

  2.   

       document.getElementsByName("price").disabled=false;
       这样设置为何没有用呢,大家帮我看下
      

  3.   

    document.getElementsByName("price")
    这个出来的是一个数组
    要用document.getElementsByName("price")[0]
    document.getElementsByName("price")[1]
      

  4.   

    document.getElementsByName("price[]")[0].disabled=false;
    document.getElementsByName("price[]")[1].disabled=false;你应该在循环里做这类设置var el = document.getElementsByName("price[]");
    for(i=0; i<el.length; i++)
      el[i].disabled = false;