This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why Won't This HTML Code Validate?