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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not valid XHTML because...why?

    Can someone tell me why this is not validating as XHTML:

    error is: Line 126, column 52: there is no attribute "onClick"
    line 126: <a href="#" onClick="window.document.blank.src='images/stamp

    I think it has something to do with the quotation marks, but...

    I was able to solve this problem before, but I can't remember how.

    Any help would be appreciated, I'm crazy about validating, and I don't know why exactly - beyond it being the best thing for everyone.

    Thanks
    Pairustwo

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    it should be
    <a href="#" onClick="window.document.blank.src='images/stamp'">

    not
    <a href="#" onClick="window.document.blank.src='images/stamp

    you were missing the close quotes and the close tag
    Kris Hubby
    kwhubby site

  • #3
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorry!

    Sorry, I just copied the line from the validator (wich doesn't show the whole of line 126). The line is quite long but the a tag is closed properly -

    <a href="#" onClick= "window.document.blank.src='images/stamp.gif';" target="_self">

    Again,it is giving me a little arrow pointing to the " character, saying that there is no attribute "onClick" .

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Use "onclick", not "onClick"

  • #5
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    arg!

    Using a lower case "c" didn't do it.

    I think the problem is described by BrainJar here. But my image swaps are thumbnails laid out in a table and I can't seem to get the
    // <![CDATA[.........// ]] to not mess up my table.--it does validate however.

    Is there any more info on this method?

    I've also used document.write to write the onclicks from an array in a seperate .js doc. everything displays properly and validates but now the swaps don't work.

    Perhaps I should give up on the XHTML validation and go back to working and valid HTML?

    What do you think?
    Pairustwo
    Last edited by pairustwo; 12-08-2002 at 10:31 PM.

  • #6
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Is it the space?

    onClick= "something"
    onClick="something" // no Space between = and "

  • #7
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope, not the space.

    Thanks though.

    pairustwo

  • #8
    New Coder
    Join Date
    Dec 2002
    Location
    Florida
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have you tried it like this, does it validate/work:

    <a onClick="javascript:window.document.blank.src='images/stamp.gif';" target="_self">

    MrDF

  • #9
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope.

    Still get the error arrow pointing at the quote character following the onclick = .


    Thanks for trying

    pairustwo

  • #10
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Perhaps:

    <a onclick="javascript:window.document.blank.src=&amp;apos;images/stamp.gif&amp;apos;;" target="_self">

  • #11
    New Coder
    Join Date
    Dec 2002
    Location
    Florida
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this strict or transitional btw, pairustwo?

    MrDF

  • #12
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ms. Doubtfire: it is transitional - I'm not that crazy

    jkd: I still get the error that "there is not an attribute 'onClick' " with a little arrow now pointing at the '&'.

    Plus : "an attribute value must be a literal unless it contains only name characters" with a little arrow pointing at the '&'.

    What about this statement from BrainJar: ...any occurance of "<" or ">" in the script code will cause a problem [with XHTML].

    He suggests using CDATA because "Text within a CDATA section will be ignored by the XML parser."


    pairustwo

  • #13
    Regular Coder
    Join Date
    Sep 2002
    Location
    Burlington, VT
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is a tough one. I might suggest a little process of elimination... try pulling the < > tags out of that... try pulling one thing out at a time until you get it to validate. Then you will at least know what you have to focus on... maybe you're not even allowed to have an onclick in that tag??

    -Doug
    "The focused mind can pierce through stone."
    - Japanese Maxim

  • #14
    New Coder
    Join Date
    Dec 2002
    Location
    Florida
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Where are you validating this, pairustwo? I ran the code through the W3C validator and it says it's fine. Can you perhaps post your DOCTYPE?

    Btw, it's -Mr- DoubtFire

  • #15
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by pairustwo
    it is transitional - I'm not that crazy
    *shrug* i code in strict
    yes perhaps you could post a little more of your document?
    there could be something else causing this(?) as MrDoubtFire mentioned.

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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