I'm working on a navigation bar that uses form buttons (just how it worked out with the content management system). With the onClick event I need to be able to set the button to the "on" css style and at the same time set the other buttons to the "default" css style.

I think I have at least come up with a structure that might work, except for the else statement... don't know what should be there... which might mean I don't need to use a loop? Anyhow, here's the js:

Code:
funtion resetButtons()
  thisClassName="default"

hasForm = false
for (i=0; i<this.form; i++) {
  if (this.form[i].name.indexOf("formName")>=0) {
  hasForm = true
  }
}

if (hasForm) {
  resetButtons
}

else {
  ''
}
In case it helps, here's the html, with only 2 buttons just as a sample:

Code:
<table>
<tr>
 <td>
<form name="psx-catformname">
  <input type="button" class="default" onMouseOut="this.className='mouseout'" onMouseOver="this.className='mouseover'" onClick="resetButtons">
</form>
 </td>
 <td>
<form name="psx-catformname">
  <input type="button" class="default" onMouseOut="this.className='mouseout'" onMouseOver="this.className='mouseover'"  onClick="resetButtons">
</form>
 </td>
</tr>
</table>