View Full Version : database DHTML doesn't validate

06-15-2007, 05:00 PM
I'm a novice at javascript, but I've been able to get a MySQL database DHTML menu to work. Trouble is, it fails validation on this:

<li><a href="# src="" onmouseup="acclarge();"" target="_self">Launch</a>

The error targets the second double quote mark after 'src='.

Here is the W3C error report:
Error Line 72 column 22: an attribute specification must start with a name or name token.
<li><a href="# src="" onmouseup="acclarge();"" target="_self">Launch</a>
An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).

This error occurs each I make a database call like the one above.

The DHTML menu item retrieves this from a database field:

# src="" onmouseup="acclarge();"

I don't understand how else this call can be made so that it will validate.

Has anyone run into this before? Sure would appreciate some help.

Philip M
06-15-2007, 06:53 PM
"This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value"

<li><a href="#"

06-15-2007, 06:56 PM
And the <a> tag doesn't have src attribute.

06-15-2007, 07:39 PM
Thanks to both of you for the help.

Unfortunately, the javascript menu package that I'm using (an Interakt product) adds double quotes to the database field that it reads. I can't control that without reworking their javascript (well beyond my abilities).

My attempts to work around those imposed double quotes hasn't worked, but I have figured out how to make it work without the 'src=""'.

Just figured out how to get this to validate.
The database fields needs to have an odd looking entry in order to accomodate the Interakt javascript double quotes:

#" onmouseup="acclarge()

The double quotes that are imposed by Interakt's product on the target field then fall into place as they should.

Again thanks for the help guys.

06-15-2007, 07:56 PM
If the value in the DB is exactly like this:

# src="" onmouseup="acclarge();"
Then, in the server-side, replace # src="" with #" so that the value becomes

#" onmouseup="acclarge();"
Then insert the variable in the link like this: (I don't know what server-side language you are using, the sample I used is ASP)

<a href="<%=theVar%> target="_self">Launch</a>
When the code is executed in the server, the output on the browser would be:

<a href="#" onmouseup="acclarge();" target="_self">Launch</a>
The solution is not good but as you said, you don't have control over the backend value.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum