代码如下,请各位帮忙看看如何修改才能在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"; }
}
}
}背景色
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"; }
}
}
}背景色
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>
应该是对象不存在,贴你的html代码
应该是对象不存在,贴你的html代码
上面贴的就是HTML中部分代码,是asp网页,源码非常多,很长
td[i].onmouseout =function mousecolor(){
去掉
parentNode跟parentElement除了前者是w3c标准,后者只ie支持,其他的区别就不是那么明显了。
parentNode跟parentElement除了前者是w3c标准,后者只ie支持,其他的区别就不是那么明显了。
更改了,没什么变化
td[i].onmouseout =function mousecolor(){
去掉红色的部分
line="hh_"+j+"_11",
row="hh_"+j+"_"+i;
应该是对象不存在,贴你的html代码
上面贴的就是HTML中部分代码,是asp网页,源码非常多,很长贴部分代码,不是让你贴出所有的
hh_1_1
hh_1_2
.
.
.
hh_2_1
.
.
.
.
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";
总结一下
不是js写法不兼容的问题,是我有部分代码中没有定义属性id
ie6中这个要求不严格,而firefox,ie8中要求更严格了
再次感谢各位的帮助