chriscloyd Posted January 21, 2009 Share Posted January 21, 2009 this is my problem im trying to make the link have a background color if thats the boxid that is showing this is my code can you help me please <script> function showstuff(boxid){ document.getElementById(boxid).style.visibility="visible"; } function showlink(boxid){ document.getElementById(boxid).style.visibility="visible"; } function hidestuff(boxid){ document.getElementById(boxid).style.color="#000000"; document.getElementById(boxid).style.background-color="#999999"; } function hidelink(boxid){ document.getElementById(boxid).style.visibility="hidden"; } </script> <link href="boe.css" rel="stylesheet" type="text/css" /> <table width="100%" border="0" cellspacing="3" cellpadding="0"> <tr> <td><a onclick="showstuff('cs16'); hidestuff('CSS'); hidestuff('zp');">CS 1.6</a> <a onclick="showstuff('CSS'); hidestuff('cs16'); hidestuff('zp'); ">CSS</a> <a onclick="showstuff('zp'); hidestuff('cs16'); hidestuff('CSS');">ZP</a> </td> <td> </td> <td> </td> </tr> <tr> <td><div id="cs16"> Server 1 Server 2 Server 3 Server 4 Server 5 </div><div id="CSS" style="visibility:hidden"> Server 1 Server 2 Server 3 Server 4 Server 5 </div><div id="zp" style="visibility:hidden"> Server 1 Server 2 Server 3 Server 4 Server 5 </div></td> <td> </td> <td> </td> </tr> </table> <p> </p> Quote Link to comment Share on other sites More sharing options...
Adam Posted January 21, 2009 Share Posted January 21, 2009 What exactly is wrong? DOM elements in JavaScript do not contain dashes, the next word is capitalized. So background-color is actually backgroundColor. Also just to add, you could do all this from one single function. You're going the extra long way around... Adam Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.