tags:

views:

146

answers:

2

Is it valid to use onload function with div element.

A: 

Not that I'm aware of -- such behavior would likely be fairly hard to define.

Just do whatever you want to do to the div ondomready (or whatever event your favorite javascript utility library provides).

timdev
+3  A: 

According to the HTML 4.01 specification:

[The onload] attribute may be used with BODY and FRAMESET elements.

The short answer to your question, then, is 'no' (at least if you want to constrain yourself to standard behavior).

Brandon E Taylor