就是一个简单的鼠标点击按钮显示、隐藏div的功能
但是在ie中不好用,点第一次显示,必须鼠标先点网页的其余部分,再单击按钮才能隐藏?
在火狐中运行正常。
请问是焦点问题还是缓存问题。网页有好几个类似鼠标单击按钮,其余都好用,就这个不好用JS部分
function import_file()
{
o2=document.getElementById('edit_tr');
o2.style.display=(o2.style.display!='none' ? 'none' : 'block');
}HTML部分
<tr id="edit_tr" style="display:none">
<td height="48" bgcolor="#FAFAF1" colspan="19"> <!--省去-->
</td>
</tr>
但是在ie中不好用,点第一次显示,必须鼠标先点网页的其余部分,再单击按钮才能隐藏?
在火狐中运行正常。
请问是焦点问题还是缓存问题。网页有好几个类似鼠标单击按钮,其余都好用,就这个不好用JS部分
function import_file()
{
o2=document.getElementById('edit_tr');
o2.style.display=(o2.style.display!='none' ? 'none' : 'block');
}HTML部分
<tr id="edit_tr" style="display:none">
<td height="48" bgcolor="#FAFAF1" colspan="19"> <!--省去-->
</td>
</tr>
<!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>
<title></title>
<script> function import_file() {
o2 = document.getElementById('edit_tr');
o2.style.display = (o2.style.display != 'none' ? 'none' : 'block');
}</script>
</head>
<body>
<table>
<tr id="edit_tr" style="display:none;">
<td height="48" bgcolor="#FAFAF1" colspan="19">
</td>
</tr>
</table>
<input type="button" onclick="import_file()" />
</body>
</html>
把你代码拿过来测试没有问题啊
如果是的话,将onchange改成onclick事件。
id="edit_tr" ID是否重复