就javascript的显示隐藏问题发表提问
下面代码是点击左边图片显示表格中被隐藏行的效果,在 ie 下正常,但在ff 下却没法实现,在网上找了些资料还是解决不了,只好请大家帮忙
代码如下:
<table width="43%"><tr><td class=style13 width=41% > <img loaded=no src=images/plus.gif id=followImg5 style=cursor:hand; onclick=loadThreadFollow(5)>aaa <a href=Show.asp?id=5 target=_blank onClick=window.close()>bbb</a></td><td align=middle width=37% class=style13>ccc</td><td width=22% colspan="3" align=middle class=style13>ccc普通</td></tr><tr height=20 style="display:none" id=follow5><td id=followTd5 align=left class=a4 colspan=3> Loading...</td></tr><tr height=1 ><td colspan=5 background=images/line.gif></td></tr></table><script>function loadThreadFollow(ino,online){var targetImg =eval("followImg" + ino);var targetDiv =eval("follow" + ino);if (targetDiv.style.display!='block'){targetDiv.style.display="block";targetImg.src="images/minus.gif";if(targetImg.loaded=="no"){document.frames["hiddenframe"].location.replace("loading.asp?id="+ino+"&forumid="+online+"");}}else{targetDiv.style.display="none";targetImg.src="images/plus.gif";}}document.write("<iframe height=0 width=0 name=hiddenframe class=style13></iframe>")</script>var targetImg =document.getElementById("followImg" + ino);var targetDiv =document.getElementById("follow" + ino);
[解决办法]
按4楼的写法,另外,不知FF对targetImg.loaded是否支持判断。
[解决办法]
parent.document.getElementById("followImg"+"+<%=id%>+").loaded="yes";
parent.document.getElementById("followTd"+"+<%=id%>+").innerHTML=' <table width=100% cellpadding=10 style=TABLE-LAYOUT:fixed> <tr> <td width=100% style=WORD-WRAP:break-word class=style13> <%=content%> </td> </tr> </table> ';
这样再试
[解决办法]
还是不行就用其他方法吧
例如
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body><input name="" type="button" value="click" onclick='loadThreadFollow(5)'/><table><tr style="display:none" id='follow5'><td id='followTd5'>123</td></tr></table><script>function loadThreadFollow(i){ var targetDiv =document.getElementById("follow" + i); if (targetDiv.style.display==''){ targetDiv.style.display="none"; }else{ targetDiv.style.display=""; document.getElementById("a").src = "loading.asp?id="+i+"&"+Math.random(); }}</script><script id="a"></script></body></html>