...

Not valid XHTML because...why?

pairustwo
12-08-2002, 06:38 AM
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

kwhubby
12-08-2002, 08:59 AM
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

pairustwo
12-08-2002, 04:20 PM
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" .

jkd
12-08-2002, 04:34 PM
Use "onclick", not "onClick"

pairustwo
12-08-2002, 09:17 PM
arg!

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

I think the problem is described by BrainJar here (http://www.codingforums.com/showthread.php?s=&threadid=10680). 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

bcarl314
12-09-2002, 01:47 PM
Is it the space?

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

pairustwo
12-09-2002, 02:11 PM
Nope, not the space.

Thanks though.

pairustwo

MrDoubtFire
12-09-2002, 03:00 PM
Have you tried it like this, does it validate/work:

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

MrDF

pairustwo
12-10-2002, 12:18 AM
Nope.

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


Thanks for trying

pairustwo

jkd
12-10-2002, 02:07 AM
Perhaps:

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

MrDoubtFire
12-10-2002, 04:28 AM
Is this strict or transitional btw, pairustwo?

MrDF

pairustwo
12-10-2002, 01:36 PM
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

dauvm
12-11-2002, 01:22 AM
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

MrDoubtFire
12-11-2002, 04:17 PM
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 :)

cg9com
12-11-2002, 07:12 PM
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.

brothercake
12-11-2002, 07:38 PM
You say you get the error "'onClick' is not an attribute", but jkd's central point is case-sensitivity:

"onClick" is invalid
"onclick" is valid


are you sure you changed it?

pairustwo
12-11-2002, 10:35 PM
:eek: Sorry Mr. Doubtfire. That wasn't a Freudian slip.

Oh I feel sick.

It was a combination of changes that I didn't make.

onClick="javascript:window.document.blank.src='images/stamp.gif'

was one and the lower case "click" was the other change.

I tried one and then tried the other but not both at the same time.

Sorry. I really feel like I can count on you guys, however.

If you want to see what all the fuss was about,
here (http://edison.seattlecentral.org/~dmeise02/guestbook) it is.

pairustwo

MrDoubtFire
12-12-2002, 02:04 PM
That looks good, a nice clean site :) I hope the problem was fixed, glad I could have offered any help.

MrDoubtFire

kwhubby
12-13-2002, 06:26 AM
wow!, thats sure well done, very backwards and forwards compatible, I wish I coded that neatly, I tend to be messy and make things only for IE.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum