Issue
A project I imported into my Eclipse IDE has an HTML file with the following near the top of the file:
<div class="header_logo"><a href="./" onclick= javascript: return changePage(0, ''); class="logo"><img src="images/logo-big.jpg" alt="Noridian" width="169" height="80" /></a></div>
The Eclipse IDE calls out the onclick as being in error: Open quote is expected for attribute "onclick" associated with an element type "a".
May I assume that the onclick should read:
<div class="header_logo"><a href="./" onclick= "javascript: return changePage(0, '');" class="logo"><img src="images/logo-big.jpg" alt="Noridian" width="169" height="80" /></a></div>
I am definitely not a Javascript expert but from what I have read, the statement following the onclick= should be surrounded with open quotes.
Solution
In HTML the unquoted attribute value syntax is only allowed for values without spaces, single quotes, etc.:
The attribute name, followed by zero or more space characters, followed by a single U+003D EQUALS SIGN character, followed by zero or more space characters, followed by the attribute value, which, in addition to the requirements given above for attribute values, must not contain any literal space characters, any U+0022 QUOTATION MARK characters ("), U+0027 APOSTROPHE characters ('), U+003D EQUALS SIGN characters (=), U+003C LESS-THAN SIGN characters (<), U+003E GREATER-THAN SIGN characters (>), or U+0060 GRAVE ACCENT characters (`), and must not be the empty string.
So yes, the error is shown correctly, as this is not valid HTML without the quotes.
Answered By - howlger