Hello everyone: I'm having difficulty getting this code to work:
HTML:
        <div id='nav_bar'>
       <ul id="ul">
<li onmouseover="test();" > <a href='friends.php' class="first"  >Friends</a>                       </li>
          <li onmouseover="test();"> <a href='messages.php' class="first">Messages</a>              </li>
          <li onmouseover="test();"> <a href='index.php' class="first">Home</a>                     </li>
          <li onmouseover="test();"> <a href='profile.php?id=<?= $prof ?>' class="first">Profile</a></li>
          <li onmouseover="test();"> <a href='find_friends.php' class="first">Search</a>            </li>
          <li onmouseover="test();"> <a href='members.php' class="first">Members</a>                </li>
          <li onmouseover="test();"> <a href='logout.php' class="first">Log Out</a>                 </li>
       </ul>
    </div>  
JAVASCRIPT:
    function test(){
x = document.getElementsByClassName("first");
x.style.backgroundColor = "#ee7600";
x.style.border = "thin solid black";
}
The Javascript file is correctly referenced by the HTML file; I'm attempting to change the style of each element with class="first" in a nav bar. Why won't document.getElementsByClass() work?
 
     
    