Javascript not validating in XHTML

tyler92

New Member
I am using the following Javascript in my XHTML document to make a "top stories" menu.
Code:
  <script type="text/javascript">
   function featured-stories(selected_story) {
    var featured-story = document.getElementsByTagName("div");
    for(var x=0; x<featured-story.length; x++) {
     classArray = featured-story[x].getAttribute("class");
     if (classArray == 'featured-story') {
      if (featured-story[x].id == selected-story) {
       featured-story[x].style.display = 'block';
      }
      else {
       featured-story[x].style.display = 'none';
      }
     }
    }
   }
  </script>
When I validate it, the "<" in the fourth line is being misinterpreted as an HTML start tag. Is there any fix for this? Thanks!
 
Top