Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About handle add element event

4 views
Skip to first unread message

susan

unread,
Jul 5, 2008, 11:39:45 PM7/5/08
to
I want to know every event about add element after document has been
completed.
Is there a such events?

Joe Fawcett

unread,
Jul 7, 2008, 2:59:08 AM7/7/08
to
"susan" <none> wrote in message
news:8D8827F9-B075-442D...@microsoft.com...

>I want to know every event about add element after document has been
>completed.
> Is there a such events?
I have no idea what that means, can you explain more?

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name


susan

unread,
Jul 7, 2008, 12:11:54 PM7/7/08
to
Jow,sorry for my poor English

I want to be notified by the DOM, when it about to add elements.


"Joe Fawcett" <joefa...@newsgroup.nospam> 写入消息
news:OSVa17$3IHA...@TK2MSFTNGP06.phx.gbl...

Joe Fawcett

unread,
Jul 10, 2008, 3:59:21 AM7/10/08
to
Do you mean you want to be notified whenever createElement is called or
whenever the internal page renderer is about to create a new node?
Or do you just want to examine a rendered page and iterate through its nodes
and get information?
What context will this code run in, a web page, a browser helper object, an
external application?

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

"susan" <none> wrote in message

news:BF22A9AC-692C-4598...@microsoft.com...

dhtml

unread,
Jul 17, 2008, 1:10:03 AM7/17/08
to
On Jul 7, 9:11 am, "susan" <none> wrote:
> Jow,sorry for my poor English

Joe.

> I want to be notified by the DOM, when it about to add elements.
>

Please don't top-post. Reply inline-style:
http://en.wikipedia.org/wiki/Posting_style#Inline_replying


> "Joe Fawcett" <joefawc...@newsgroup.nospam> 写入消息news:OSVa17$3IHA...@TK2MSFTNGP06.phx.gbl...


>
> > "susan" <none> wrote in message
> >news:8D8827F9-B075-442D...@microsoft.com...
> >>I want to know every event about add element after document has been
> >>completed.
> >> Is there a such events?

Yes. DOMNodeInserted and DOMSubtreeModified would work.

http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MutationEvent

addEventListener("load", addMutationEvents, false);
function addMutationEvents(e) {
document.addEventListener("DOMNodeInserted", function(e) {
alert(e.relatedNode);
}, false);
}


Try and see if your browser supports:-

javascript:document.addEventListener("DOMNodeInserted", function(e)
{alert(e.relatedNode);},
false);void(document.body.appendChild(document.createElement('div')))

IE7 and IE8b1 don't support any of DOM Events.
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MutationEvent

0 new messages