Validator trying to validate javascript as HTML

The script on my page looks something like this:
<script language="javascript" type="text/javascript"> 
  function addOption(targetElement,value){
    for(var a=0 ; a<targetElement.length ; a++){
      if( targetElement[a].text == value) value = '-'
    for(var a=targetElement.length;a!=0;a--){
      if( targetElement[a-1].selected)targetElement.remove(a-1)

Validator thinks that because I use a "<" then its a HTML element.
<targetElement.length is not a valid element etc...
Ok ok ok..., I will put comments around the code then
  same script code
Now it thinks that my "a--" in the script code ends the comment tag???
ehm.... hehe...
Any ideas ?

 Torben Rudgaard
 Chat, Classmates, Campaigns
 Office: +45 3327 9072
 Mobile:+45 2674 3555
 E-mail: <>  	

Received on Wednesday, 19 March 2003 20:13:00 UTC