img的click事件问题
function img_click(img){
if (img == null
[解决办法]
img.currentTarget != null) img = this; //兼容ie
if (img.alt == "加号") {
img.alt = "减号";
img.src = "images/小减号2.gif";
}
else if (img.alt == "减号") {
img.alt = "加号";
img.src = "images/小加号.gif";
}
}
function bind_imgs_click() {
var img_list = document.getElementsByTagName("img");
for (var i = 0; i < img_list.length; i++) {
if (img_list[i].style.display != "none") img_list[i].onclick = img_click;
}
}
var list1 = new Array();
list1[0] = "管理费用";
list1[1] = "税费";
var list2 = [["工资", "节日费"], ["国税", "地税"]];
window.onload = bind_imgs_click();
$("img[display!=none]").click(function(){
var thisimg=$(this);
if(thisimg.attr("alt")=="加号")
{
thisimg.attr("alt","减号");
thisimg.attr("stc","images/小减号2.gif");
}else
{
thisimg.attr("alt","加号");
thisimg.attr("stc","images/小加号2.gif");
}
});