代码如下,请各位帮忙看看如何修改才能在firefox下有效
function color()
  {
  for(var j=1;j<=MonthDays;j++){
  for(var i=1;i<=10;i++){
  var line,row; 
  line="hh_"+j+"_11";
  row="hh_"+j+"_"+i+"";  if(document.getElementById(line).value==0){
  document.getElementById(row).style.backgroundColor="#cc99cc";  }
  }
  }
  }背景色

解决方案 »

  1.   

    if(document.getElementById(line).value=="0"){ 试试
      

  2.   

    if(parseInt(document.getElementById(line).value)==0)
      

  3.   

      <script type="text/javascript"> 
    window.onload = function(){
    mousecolor();
    color();
    }
    var MonthDays = 30
    function mousecolor(){
    var td = document.getElementById("senfe").getElementsByTagName("td");
    for(var i=MonthDays+2; i<td.length; i++){
        if (i%(MonthDays+2)>1){
    td[i].onmouseover = function mousecolor(){
    for(var j=2; j<td.length; j++){
    if(td[j].cellIndex==this.cellIndex || td[j].parentElement.rowIndex==this.parentElement.rowIndex){
    td[j].style.backgroundColor="#ff6600";
    }
    }
    }
    td[i].onmouseout =function mousecolor(){
    for(var j=0; j<td.length; j++){
    if(td[j].cellIndex==this.cellIndex || td[j].parentElement.rowIndex==this.parentElement.rowIndex){
    td[j].style.backgroundColor="";
    }
     
    }
    }
    }
    }
    }
    //]]-->

    function color()
      {
      for(var j=1;j<=MonthDays;j++){
      for(var i=1;i<=10;i++){
      var line,row; 
      line="hh_"+j+"_11";
      row="hh_"+j+"_"+i;
     
      if(document.getElementById(line).value==0){
      document.getElementById(row).style.backgroundColor="#cc99cc";
     
      }
      }
      }
      }
    </script>
      

  4.   


    应该是对象不存在,贴你的html代码
      

  5.   


    应该是对象不存在,贴你的html代码
    上面贴的就是HTML中部分代码,是asp网页,源码非常多,很长
      

  6.   

    var MonthDays = 30;
      

  7.   

    td[i].onmouseover = function mousecolor(){
     td[i].onmouseout =function mousecolor(){
    去掉
      

  8.   

    parentElementNode
      

  9.   

    查了下
    parentNode跟parentElement除了前者是w3c标准,后者只ie支持,其他的区别就不是那么明显了。
      

  10.   

    查了下
    parentNode跟parentElement除了前者是w3c标准,后者只ie支持,其他的区别就不是那么明显了。
    更改了,没什么变化
      

  11.   

    td[i].onmouseover = function mousecolor(){
     td[i].onmouseout =function mousecolor(){
    去掉红色的部分
      

  12.   

    var line,row; 
      line="hh_"+j+"_11",
      row="hh_"+j+"_"+i;
      

  13.   


    应该是对象不存在,贴你的html代码
    上面贴的就是HTML中部分代码,是asp网页,源码非常多,很长贴部分代码,不是让你贴出所有的
      

  14.   

    为什么要写成backgroundColor 而不是background?
      

  15.   

    看看有没有定义属性id
    hh_1_1
    hh_1_2
    .
    .
    .
    hh_2_1
    .
    .
    .
    .
      

  16.   

    不过这些id都是asp生成的,非静态页面
      

  17.   

      line="hh_"+j+"_11";
      row="hh_"+j+"_"+i;
      
      if(document.getElementById(line).value==0){
      document.getElementById(row).style.backgroundColor="#cc99cc";你的 id 都是组装的,需先验证存在
    if(document.getElementById(line) && document.getElementById(row)) {
      if(document.getElementById(line).value==0){
      document.getElementById(row).style.backgroundColor="#cc99cc";
      

  18.   

    问题终于解决
    总结一下
    不是js写法不兼容的问题,是我有部分代码中没有定义属性id
    ie6中这个要求不严格,而firefox,ie8中要求更严格了
    再次感谢各位的帮助