xhtml 1.0 strict with javascript

  • Thread starter Sergio del Amo Caballero
  • Start date

S

Sergio del Amo Caballero

Hello,
I want to validate my simple page with xhtml 1.0 strict. But i want to
use javasript inside. When i try the validator the answer is:

Error:
# Line 33, column 39: there is no attribute "onClick"
<a href="http://www.marca.com" onClick="newwindow();return false">Click
Here!<..

newwindow is a function.

How can i use javascript inside xhtml 1.0 using for example onClick or
onMouseover with a valid xhtml 1.0?.

My Doctype is this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">

Waiting for your feedback.
 
Ad

Advertisements

J

Jim Ley

I want to validate my simple page with xhtml 1.0 strict.

Why use XHTML 1.0 strict, so few browsers support this, HTML 4.01
strict is much more supported, I'd recommend switching to that - tidy
will automate it for you.

(or alternatively you can read the actual xhtml documentation and note
that attributes are all lower case)

Jim.
 
B

bengee

Sergio said:
Error:
# Line 33, column 39: there is no attribute "onClick"
<a href="http://www.marca.com" onClick="newwindow();return false">Click
Here!<..

Weird... i've got this in my XHTML 1.0 Strict page...

<a href="#" onclick="someFunction();">click here</a>

.... and it validates perfect. Try that?

bengee
 
S

Sergio del Amo Caballero

Thanks for the feedback, i proved in lower case and validate perfectly.
 
B

bengee

Sergio said:
Thanks for the feedback, i proved in lower case and validate perfectly.

That sounds right. I read somewhere that all XHTML tags and elements
need to be in lowercase.

bengee
 
Ad

Advertisements

R

Richard Hockey

in XHTML all the javascript events should be in lower case, i.e.: onclick,
onmouseover, onblur etcetera
 
Ad

Advertisements


Top