W3C home > Mailing lists > Public > www-validator@w3.org > March 2003

Re: Validator trying to validate javascript as HTML

From: David Bryant <davidbryant@att.net>
Date: Wed, 19 Mar 2003 18:28:17 -0700
Message-ID: <3E791931.4070304@att.net>
To: "Torben V. Rudgaard" <torben@jubii.dk>
CC: "'www-validator@w3.org'" <www-validator@w3.org>

Torben V. Rudgaard wrote:

> 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)
>     }
> </script>
> Validator thinks that because I use a "<" then its a HTML element.

What does your <!doctype> say?

I took your script verbatim and put it inside an html 4.01
wrapper and it validated OK. So if you're having problems
with it, you're either using some other version of html,
or the problem relates to something besides the script
you quoted.  dcb
Received on Wednesday, 19 March 2003 20:31:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:06 GMT