<script type="text/javascript">
<!--
    function switchCellleft(n){for(i=0;i<trd.length;i++){trd[i].style.display="none";lftd[i].className="box_gary05";}trd[n].style.display="block";lftd[n].className="box_gary01";}
//-->
</script>
上面是我的javascript脚本,在IE上是可以看到效果的,为什么到Firefox就没有效果了呢?请各位大虾指点下!在此先谢过了!

解决方案 »

  1.   

    trd为table行 的 id,lftd为列的ID
    我的设计页面是这样的:
    <%@ Control Language="C#" AutoEventWireup="true" Codebehind="procleft.ascx.cs" Inherits="WebApp.UserControl.procleft" %>
    <script type="text/javascript">
    <!--
        function switchCellleft(n){for(var i=0;i<trd.length;i++){trd[i].style.display="none";lftd[i].className="box_gary05";}trd[n].style.display="block";lftd[n].className="box_gary01";}
    //-->
    </script>
    <table width="160px" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="box_gary03" style="height: 36px">
            </td>
        </tr>
        <tr>
            <td class="box_black" style="height: 18px">
                <asp:Literal ID="Lit_ProdServ" runat="server" Text="<%$ Resources:SiteResource, head_ProdServ %>"></asp:Literal></td>
        </tr>
        <tr>
            <td class="box_gary01" onclick="switchCellleft(0)" id="lftd">
                <a href="../proclist.aspx" class="left_blue">+
                    <asp:Literal ID="Lit_products" runat="server" Text="<%$ Resources:SiteResource, left_products %>"></asp:Literal></a></td>
        </tr>
        <tr id="trd" style="display: none;">
            <td bgcolor="#E0F4FB">
                <table width="160px" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="box_gary03" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../proclist.aspx?type=p001" class="left_blue"
                                id="p001"><asp:Literal ID="Lit_Prod_RF" runat="server" Text="<%$ Resources:SiteResource, left_prod_RF %>"></asp:Literal></a>
                        </td>
                    </tr>
                    <tr>
                        <td class="box_gary03" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../proclist.aspx?type=p002" class="left_blue"
                                id="p002"><asp:Literal ID="Lit_Prod_Automotive" runat="server" Text="<%$ Resources:SiteResource, left_prod_Automotive %>"></asp:Literal></a>
                        </td>
                    </tr>
                    <tr>
                        <td class="box_gary03" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../proclist.aspx?type=p003" class="left_blue"
                                id="p003"><asp:Literal ID="Lit_Prod_Distributed" runat="server" Text="<%$ Resources:SiteResource, left_prod_Distributed %>"></asp:Literal></a>
                        </td>
                    </tr>
                    <tr>
                        <td class="box_gary05" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../proclist.aspx?type=p004" class="left_blue"
                                id="p004"><asp:Literal ID="Lit_Prod_More" runat="server" Text="<%$ Resources:SiteResource, left_prod_More %>"></asp:Literal></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="box_gary05" style="height: 19px" onclick="switchCellleft(1)" id="lftd">
                <a href="../service.aspx" class="left_blue"><span>+
                    <asp:Literal ID="Lit_Services" runat="server" Text="<%$ Resources:SiteResource, left_Services %>"></asp:Literal></span></a></td>
        </tr>
        <tr id="trd" style="display: none;">
            <td bgcolor="#E0F4FB">
                <table width="160px" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="box_gary03" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../service.aspx?type=s001" class="left_blue"
                                id="s001"><asp:Literal ID="Lit_Services_RF" runat="server" Text="<%$ Resources:SiteResource, left_Services_RF %>"></asp:Literal></a>
                        </td>
                    </tr>
                    <tr>
                        <td class="box_gary03" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../service.aspx?type=s002" class="left_blue"
                                id="s002"><asp:Literal ID="Lit_Services_Automotive" runat="server" Text="<%$ Resources:SiteResource, left_Services_Automotive %>"></asp:Literal></a>
                        </td>
                    </tr>
                    <tr>
                        <td class="box_gary05" style="width: 160px">
                            <font color="#0087ff">&nbsp;.</font> &nbsp;<a href="../service.aspx?type=s003" class="left_blue"
                                id="s003"><asp:Literal ID="Lit_Services_Production" runat="server" Text="<%$ Resources:SiteResource, left_Services_Production %>"></asp:Literal></a>
                        </td>
                    </tr>
                </table>
           
      

  2.   

    用了不兼容ff的js方法 或者css属性