mary jean ligas

mary jean ligas

  • NA
  • 420
  • 191.9k

how to put condition on document.getelementid with css

Apr 19 2013 12:29 AM
how to put condition on document.getelementid with css using single aspx page but different id on my links..i have designed the links on the left corner of my masterpage but the problem is when i declare script for  "document.getelementid" and the links are in same url location the selected part on my link was being called also. what i want is when i clicked link 1(id="nonmto") then the font color are highlighted to white and when i clicked a link 2(id="mto") then it will remove the color of my link 1 and the link 2 will change the highlight into white..

here is my snipet:

 <div id="Left" class="Left-ContentLive">
       <ul>
           <li>
               <a id="nonmto" href="NewConcession.aspx?id=1" class="">
                   <asp:Label runat="server" ID=lblNew Font-Size="8" Font-Italic="true">New</asp:Label>
                   <br>&nbsp CP Traditional Trade<br><br>
               </a>
           </li>
           <li>
               <a id="mto" href="NewConcession.aspx?id=2" class="">
                   <asp:Label runat="server" ID=Label1 Font-Size="8" Font-Italic="true">New</asp:Label>
                   <br>&nbsp CP Modern Trade<br><br>
               </a>
           </li>
           <li>
               <a id="cs" href="NewContract.aspx?id=0" class="">
                  <asp:Label runat="server" ID=lblNew2 Font-Size="8" Font-Italic="true">New</asp:Label>
                 <br>&nbsp Contract Synopsis
                 <br /><br /><br /><br />
               </a>
               <hr />
           </li>
           <li>
                <a id="dwnStd" href="DownloadTemplates.aspx" class="">
                    <br />
                    <asp:Label runat="server" ID=lblDownload Font-Size="8" Font-Italic="true">Download</asp:Label>
                    <br>&nbsp Standard Templates<br /><br>
                </a>
           </li>
           <li>
                <a id="report" href="ReportList.aspx" class="">
                   <asp:Label runat="server" ID=Label2 Font-Size="8" Font-Italic="true">Generate</asp:Label>
                   <br>&nbsp Reports<br /><br>
                </a>
           </li>
           <li>
                <a id="NewCLMSUser" href="NewUser.aspx" class="">
                    <asp:Label runat="server" ID=lblNewUser Font-Size="8" Font-Italic="true">New</asp:Label>
                    <br>&nbsp <asp:Label runat="server" ID="lblCLMSUser">CLMS User</asp:Label>
                </a>
           </li>
       </ul>


then on my page:

<script type="text/javascript">
        document.getElementById("nonmto").setAttribute("class", "Selected");
       document.getElementById("mto").setAttribute("class", "Selected");
</script>
<div>
             NewConcession PAGE design
</div>


please help me...