$.getJSON("js/question.json",function(data, status, xhr){
var i = 0;
// alert(data.questions[1].ID)
while(data[i])
{
$("tr").last().after("<tr><td><input type='checkbox'/></div></td><td><div style='overflow:hidden;width:30px'>"+data[i].ID+"</div></td><td><div style='overflow:hidden;width:40px'>"+data[i].classify+"</div></td><td><div style='overflow:hidden;width:80px'>"+data[i].question_content+"</div></td><td><div style='overflow:hidden;width:80px'>"+data[i].question_tag+"</div></td><td><div style='overflow:hidden;width:80px'></td><td><div style='overflow:hidden;width:80px'></div></td><td><div style='overflow:hidden;width:80px'></div></td><td><div style='overflow:hidden;width:80px'></div></td></tr>");
i++;
} $("tr").mouseover(function(){
//alert("click success")
alert(this);
$(this).attr("style",$(this).attr("style")+";word-break:break-all");
});上面的$("tr").mouseover(function()
没有走进去,不知道为什么?没有找到tr
直接写在html里的
<table id = "testTable" border="1px" bordercolor="#8a9595" cellspacing="0px" style="border-collapse:collapse" align="center" >
<tr>
<th><div style="overflow:hidden;width:10px"></div></th>
<th><div style="overflow:hidden;width:40px">ID</div></th>
<th><div style="overflow:hidden;width:40px">类型</div></th>
<th><div style="overflow:hidden;width:80px">题目</div></th>
<th><div style="overflow:hidden;width:80px">选项</div></th>
<th><div style="overflow:hidden;width:80px">解析</div></th>
<th><div style="overflow:hidden;width:80px">分值</div></th>
<th><div style="overflow:hidden;width:80px">时限</div></th>
<th><div style="overflow:hidden;width:80px">关键字</div></th>
</tr>
</table>这里的tr是能找到的。
}
alert("alert看走没走到")
$("tr").mouseover(function(){应该是alert上面部分的问题
我在html里直接写出的tr是能够走进这个函数的,但是在js里循环出的这个表就是走不进这个函数,但是页面已经刷出这个表了。就是mouseover这个动作没响应。