Hi.
I would like to know how to obtain a reference to (or at least, element
type of) the last node which was inserted into the document. I am using
an event listener to listen for dom inserts, but I am not sure how to
check if that last node was a script tag.
Please could someone point me in the right direction?
Many thanks, and Merry Christmas.
Daz. 2 2955
Daz wrote:
I would like to know how to obtain a reference to (or at least, element
type of) the last node which was inserted into the document. I am using
an event listener to listen for dom inserts, but I am not sure how to
check if that last node was a script tag.
If that is the W3C DOM Level 2 DOMNodeInserted event e.g.
document.addEve ntListener('DOM NodeInserted', function (evt) {
alert(evt.targe t + ' inserted under parent ' + evt.relatedNode );
}, false);
then the evt.target tells you the inserted node and evt.relatedNode the
parent node into which evt.target has been inserted. So you can check
whether evt.target is an element node and if so, its
tagName.toLower Case() is 'script'.
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote:
Daz wrote:
I would like to know how to obtain a reference to (or at least, element
type of) the last node which was inserted into the document. I am using
an event listener to listen for dom inserts, but I am not sure how to
check if that last node was a script tag.
If that is the W3C DOM Level 2 DOMNodeInserted event e.g.
document.addEve ntListener('DOM NodeInserted', function (evt) {
alert(evt.targe t + ' inserted under parent ' + evt.relatedNode );
}, false);
then the evt.target tells you the inserted node and evt.relatedNode the
parent node into which evt.target has been inserted. So you can check
whether evt.target is an element node and if so, its
tagName.toLower Case() is 'script'.
--
Martin Honnen http://JavaScript.FAQTs.com/
Fantastic!
Thanks Martin. :) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roger Withnell |
last post by:
I'm inserting a new record into an MS SQL database table
and I want to obtain the new records autonumber
immediately afterwards, as follows:
MadminRS.CursorLocation = adUseServer
MadminRS.CursorType = adOpenKeyset
MadminRS.LockType = adLockOptimistic
MadminRS.Open "NavBar", objConn, , , adCmdTable
MadminRS.AddNew
MadminRS("Url") = Request.Form("Website")
MadminRS("ParentRecNo") = 0
|
by: PT |
last post by:
I got a problem. And thats.....
First of all, I got these three tables.
------------------- ------------------ ----------------------
tblPerson tblPersonSoftware tblSoftware
------------------- ------------------ ----------------------
PID PName PID* SID* SID SWName
--- ----- --- --- --- ------
1 Thomas 1 1 ...
|
by: Steve Roberts |
last post by:
I want to write a graphical view of an XML tree, using a DOM interface, that
allows the XML tree to be edited, with nodes being added or removed.
For this I was going to create a basic tree structure, mirroring the
structure held in the DOM. Every node of the new tree would reference a
matching DOM node. However, I'm not familiar enough with the DOM to know if
it's possible to uniquely identify every DOM node, in such a manner that the...
|
by: JonQuark |
last post by:
Hi,
I suspect this is a common question but I've read the FAQ and searched
the archives and couldn't find it. In a script embedded in the body of
the page I want to quickly find the last node that was created and
appendChild nodes to it. I can't just use document.body.appendChild as
the last node is likely to be a grandchild or great-grandchild of body.
I know that I could document.write an element with an id and then
getElementById but...
|
by: chris yoker via DotNetMonster.com |
last post by:
hiya,
I can obtain innnerText of a node as follows:
<code>
itemCode = currNode.ChildNodes(4).InnerText()
<\code>
great, but if change the XML node order, then I have to re-code.
I tried to assign as follows, but no joy.
| |
by: Kevin Burton |
last post by:
I don't think I understand the last() function.
I have a document that looks like:
<Root>
<Header>Some text</Header>
<Message>
<MessageID>1</MessageID>
. . . .
</Message>
|
by: sangram |
last post by:
how to delete last node of a Linked list if you only know the address
of last node.
thanks
sangram
|
by: dennis.sprengers |
last post by:
I am trying to write an editor object, which adds some functionality
and a toolbar to every textarea with a "form-textarea" class. Both FF
and IE generate an error in line 20
(container.appendChild(this.toolbar);) saying "Node cannot be inserted
at the specified point in the hierarchy" code: "3"
I have two questions:
- who would help me with this error
- please provide other feedback about my code, since I want to write a
solid...
|
by: Ebenezer |
last post by:
Hello!
Let's suppose we have an XML with some nested NODE nodes:
<root attr="first">
<node id="1" attr="mike">
<node id="2" />
<node id="3" attr="dave" />
</node>
<node id="4">
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |