File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Why Won't This HTML Code Validate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Why Won Watch "Why Won New topic
Author

Why Won't This HTML Code Validate?

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Hello,

I'm trying to validate the following code and I get an error for line 57 saying that the <script> tag doesn't belong here, yet the code seems to run OK. What's wrong? Why won't it validate?


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Just a nit pick


should be a label



It is more accessible this way.

Now, what are you using to validate this?

Eric>
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Now, what are you using to validate this?


validator.w3.org
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

It looks like that script should be in an onload function (or jquery or the like equivalent) rather than in the main body of the page between HTML form elements. That way it still runs after the select box is rendered, but is more logically separate.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why Won't This HTML Code Validate?