Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Location
    virginia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    database DHTML doesn't validate

    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:

    Code:
    <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:
    Code:
    # 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.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,924
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    "This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value"

    <li><a href="#"

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    And the <a> tag doesn't have src attribute.

  • #4
    New to the CF scene
    Join Date
    Feb 2007
    Location
    virginia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    #" 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.
    Last edited by BobLoblaw; 06-15-2007 at 06:57 PM. Reason: figured it out

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    If the value in the DB is exactly like this:
    Code:
    # src="" onmouseup="acclarge();"
    Then, in the server-side, replace # src="" with #" so that the value becomes
    Code:
    #" 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)
    Code:
    <a href="<%=theVar%> target="_self">Launch</a>
    When the code is executed in the server, the output on the browser would be:
    Code:
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •