Note that you can also validate pages in the W3C validator from directly within the Opera browser by simply right/Ctrl-clicking and selecting the “Validate” option.
Just enter this code at the top of your Java Script file (naturally, replace the names below with theobjects/methods you use): Some people prefer to navigate to the JSLint page, paste in your code, and validate it, while other people feel they become faster if they can do it natively in their preferred development environment.Although web browsers will accept bad (invalid is the official term) web pages and do their best to render the code by making a best guess of the author’s intention, it is still possible to check whether the HTML has been written correctly, and indeed it is a good idea to do so, as you’ll see below. The validation program compares the HTML code in the web page with the rules of the accompanying doctype and tells you if and where those rules have been broken.There is a common feeling amongst some web developers that if a web page looks fine in browsers, it doesn’t matter if it doesn’t validate.The most common three validators you’ll use are: In this Web Standards Curriculum article, we will cover how to use the first two of these, showing you how to validate markup, interpreting the typical kinds of results the validator gives you.The link checker is very obvious, and we'll cover debugging CSs later on in the course.This is almost always the case for HTML anyway, with other standards having a few more differences in support here and there. It basically says “ok, this code doesn’t validate, so how do we present this page to the end user? When you try to render this across different browsers, they interpret the code in very different ways: This original version of this example can be found in Hallvord Steen’s article Same DOM errors, different browser interpretations — read this for a much deeper treatment of HTML errors, and some information about debugging tools.
None of the different browsers’ behaviours is incorrect; they’re all trying to fill in the gaps of your incorrect code.
The HTML specification says how you should write it, and how they should interpret your document.
In recent times, standards compliance of browsers has reached the point where, as long as you write valid code, all the major browsers should interpet your code the same. The answer is that the browser error handling comes into play to work out what to do with the code. If you leave a few errors in your page, the browser will fill in the gaps for you? For example: element is incorrectly nested across multiple block elements, and the anchor element is not closed.
They describe validation as an ideal goal, but not something that is a black-and-white issue. The HTML4 specification is not perfect, and some things that were arguably correct — such as starting an ordered list at a point other than 1 — were invalid HTML.
HTML5 fixes quite a lot of spec issues including this one, but you may still run into situations where the validation may need to be broken.
At the time of writing however, support for this HTML5 error handling was not widespread across browsers, so you can't yet rely on it. A shot rang out from my rifle, and I called for Buster to collect the goose I had felled.