标题:ie和firefox中的js区别
只看楼主
porsche
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-6-24
 问题点数:0 回复次数:3 
ie和firefox中的js区别
小弟现有一段js代码,在ie中可以正常使用,但是到ff中就不能,望指教!
代码如下:
<script type="text/JavaScript">
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
imgmenu = eval("imgmenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
imgmenu.background="images/bg_nav1.gif";
imgmenu.className='whi12B';
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
imgmenu.background="images/bg_nav.gif";
imgmenu.className='blu12B';
}
}
</script>

<table width="200" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="30"></td>
          </tr>
          <tr>
            <td height="34" valign="bottom" background="images/bg_nav.gif" id="imgmenu0" style="cursor:hand" onClick="showsubmenu(0)" class="blu12B" onmouseover="showbg(0)" onmouseout="hidbg(0)"><div style="margin-left:34px; margin-bottom:13px">aaaaaaa</div></td>
          </tr>
          <tr>
            <td id="submenu0" style="DISPLAY: none"><table width="200" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="34" height="21" align="right" background="../images/bg_nav.gif"><img src="../images/btm_tubiao7.gif" width="2" height="3" hspace="5" /></td>
                  <td width="166" align="left" valign="middle" background="../images/bg_nav.gif"><a href="11.htm" class="blk10" id="subitem1">11</a></td>
                </tr>
                <tr>
                  <td height="1" colspan="2" align="left" valign="top" background="../images/img_line1.gif"></td>
                </tr>
                <tr>
                  <td height="21" align="right" background="../images/bg_nav.gif"><img src="../images/btm_tubiao7.gif" width="2" height="3" hspace="5" /></td>
                  <td align="left" valign="middle" background="../images/bg_nav.gif"><a href="22.htm" class="blk10" id="subitem2">22</a></td>
                </tr>
                <tr>
                  <td height="1" colspan="2" align="left" valign="top" background="../images/img_line1.gif"></td>
                </tr>
            </table></td>
          </tr>
        </table>
搜索更多相关主题的帖子: firefox 
2008-06-24 11:41
渚薰
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:1132
专家分:0
注 册:2006-8-6
得分:0 
element的对象,在ie下可以直接用document.elementName访问
在ff下,必须用document.getElementById(elementId)来获取(ie下也可如此)

个人ajax技术专题站: " target="_blank">http://www. 我不会闲你烦,只会闲你不够烦!
2008-06-25 09:18
tomtory
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:705
专家分:0
注 册:2008-6-12
得分:0 
楼上处理
2008-06-25 17:44
frankqnj
Rank: 4
等 级:贵宾
威 望:12
帖 子:320
专家分:278
注 册:2008-4-6
得分:0 
imgmenu.background="images/bg_nav.gif";
imgmenu.className='blu12B'

html 元素中 怎么没看到有 id=imgmenu 的元素? 只有 id=imgmenu0

你这样 ie中应该也用不了啊
2008-06-25 19:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-220881-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.937259 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved