How to div, p add onload event?

premise

In fact, only the <body>, <frame>, <iframe>, <img>, <link>, <script>, <style> These labels have onload event, and div, p and other labels is not.

But do something if we want to div append DOM how to do it? Some would say it after the code to append DOM of the increase is not on the list, but it will have to eleven written on the back of each append place, good trouble.

E.g

< Div > 
    < the p- > I have a small donkey, I never ride. </ P > 
</ div >

Let's say I want to load after the above content, pop-up "I'm a little donkey" prompt box.

Jiehuaxianfo

I still want to deal with the onload event, and we know what tags are supported, so you can change the code:

< Div > 
    < the p- > I have a small donkey, I never ride. </ The p- > 
    < style the onload = "Alert ( 'I am a small donkey')" > </ style > 
</ div >

Such borrowing style tags, as long as the div append to the DOM, you can simulate trigger onload event. 

Guess you like

Origin www.cnblogs.com/lovesong/p/12040819.html