Loop through .

Loop through .

 <div id="menu">
      <ul>       
        <li><a id="selected" href="index.html">home</a></li>
        <li><a href="index.html">Menu1</a></li>
        <li><a href="index.html">Menu2</a></li>
        <li><a href="index.html">Menu3</a></li>
        <li><a href="index.html">Menu4</a></li>
      </ul>
    </div>

Hi,
what would be the script for setting the id="selected" on the anchor elements. when  a user clicks also should remove the id property from the previously selected anchor.
Thanks