2011-10-27 3 views
2

안녕하세요 저는 클릭 할 때 두 테이블의 전체 셀을 클릭 할 때 배경색을 변경하는 jquery 스크립트를 사용하고 있습니다. 그런 다음 양식 단추를 클릭하고 선택한 셀을 데이터베이스로 처리 할 수 ​​있습니다.Jquery 스크립트는 Firefox 8에서는 작동하지만 IE 8에서는 작동하지 않습니다.

이 스크립트는 Firefox 및 iPads 브라우저에서 작동합니다.

(그래서 순간에 변경할 수 없습니다 SOE의 일부입니다)

JQuery와 스크립트가

$(document).ready(function() { 
//assigning alternative row style 
$(".pretty tr:even").addClass("evenrow"); 
$(".pretty tr:odd").addClass("oddrow"); 

$(".my_table tr").find(':checkbox').prepend('<img id="tableSquare" src="images/square.png" />'); 


$(".pretty tr:even").click(function() { 
    $(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked')); 
    if ($(this).find(':checkbox').attr('checked')) { 
     $(this).removeClass('evenrow'); 
     $(this).addClass('highlight'); 


    } 
    else { 
     $(this).removeClass('highlight'); 
     $(this).addClass('evenrow'); 
    } 
}); 
$(".pretty tr:odd").click(function() { 
    $(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked')); 
    if ($(this).find(':checkbox').attr('checked')) { 
     $(this).removeClass('oddrow'); 
     $(this).addClass('highlight'); 
    } 
    else { 
     $(this).removeClass('highlight'); 
     $(this).addClass('oddrow'); 
    } 
}); 

}) 비록 그것은 IE 8에서 작동하지 않습니다

;

IE 8에서는 테이블 중 하나의 셀만 클릭 할 수 있으며 페이지를 새로 고침하면 그 필드는 작동하지 않습니다.

jquery 1.6.4를 사용하십시오.

다음은 부분적으로 작동하는 예입니다. http://jsfiddle.net/unauu/23/

어떤 스크립트가 IE 8에서 작동하지 않습니까?

+0

디버깅을 한 적이 있습니까? IE8에서 오류가 발생합니까? – maxedison

답변

2

IE에서 .attr()을 한 번 사용하여 비슷한 문제가 발생하고 대신 .prop()를 사용하려고했는데 내 문제를 해결했으며 분명히 여러분의 생각도 마찬가지입니다. 이런 일이 발생하는 이유

http://jsfiddle.net/unauu/24/

나도 몰라.

관련 문제