2
您好我有一個jQuery腳本,允許點擊兩個表中的所有單元格,當點擊它們改變它們的背景顏色。然後,您可以單擊表單按鈕,並將選定的單元格處理爲數據庫。jquery腳本工作在Firefox但不IE 8
該腳本適用於Firefox和iPad瀏覽器。
雖然(這是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/
任何ide腳本不能在IE 8中工作?
你有沒有做過任何調試? IE8會拋出任何錯誤嗎? – maxedison