Re: [VE][108] onload attribute does not exist for < IMG>?

On 25 Mar 2008, at 16:16, Ruben Tilis wrote:
> W3 describes "onload" event: " The onload event occurs immediately  
> after a page or an image is loaded.".  Please see at your  
> page:http://www.w3schools.com/jsref/jsref_onload.asp
>
Despite their misleading name, the highly error prone W3Schools is  
not, in any way, associated with the W3C.

If you check the specification ( http://www.w3.org/TR/html4/index/ 
attributes.html ), you will see the onload attribute is only  
supported by the body and frameset elements in HTML 4.x and XHTML 1.x.

> This event attribute is essential for dealing with every loading  
> element.

No, it isn't, since JavaScript can be used to attach events.

A lot of current thinking considers intrinsic event attributes to be  
something to be avoided in favour of scripts which can be added to  
the document and which then operate on elements based on their  
classes and ids.

http://en.wikipedia.org/wiki/ 
Unobtrusive_JavaScript#Separation_of_behavior_from_markup

> All browsers support this attribute

No, they don't.

> and I just can't see why W3 contradicts it's itself

It doesn't.

> and force developers to choose between bad programming and  
> forsaking W3 validation.

As explained above, it doesn't.

-- 
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/

Received on Wednesday, 26 March 2008 10:10:13 UTC