473,761 Members | 9,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing DOM elements in an embedded doc

Dear all, I have something like this:

<html... >
<embed ...>
</html>

Am I out of luck if I wanted to access the embedded DOM and manipulate its
content?

Or if I have:

<svg ...>
<svg ...>
...
</svg ...>
</svg>

Is it possible to manipulate the inner svg elements from a script defined in
the outer? I tried

var SVGDoc = evt.getTarget() .getOwnerDocume nt();
var SVGRoot = SVGDoc.getDocum entElement();
var SVGInner = SVGDoc.getEleme ntsByTagName("s vg");
SVGInner.curren tTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget() .getOwnerDocume nt();
var SVGRoot = SVGDoc.getDocum entElement();
SVGRoot.current Translate.x += dx;

then the entire outer document gets translated, I've also tried
SVGDoc.getEleme ntByID and getfirstChild with no luck... can someone point me
in the right direction?

Thanks, Jules

Jul 20 '05 #1
1 2998


Julius Mong wrote:
Dear all, I have something like this:

<html... >
<embed ...>
</html>

Am I out of luck if I wanted to access the embedded DOM and manipulate its
content?
As browsers offer an <embed> element to embed content rendered by
plugins I am not sure what your example is, an attempt to provide a HTML
snippet which you script inside of a browser and where you then usually
be able to script the <embed> element if the plugin exposes an API to
JavaScript, or an attempt to define your own new element <embed> that is
supposed to embed on HTML document into another. If the latter I am
wondering why you do not use <iframe> or <object> as that are the tools
HTML 4 (or XHTML 1) provides to embed another HTML page. As for
accessing them, yes, inside of a browser and with the HTML DOM there are
properties, see
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-67133006
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-38538621
for contentDocument of an <iframe> or <object> element.

Of course if it is not inside of a browser and you are just using the
W3C DOM Core then it is diffifult. So you need to tell us how you are
going to use the DOM, with which language, which level and which modules
you have available.
Or if I have:

<svg ...>
<svg ...>
...
</svg ...>
Does SVG allow to nest <svg> elements? </svg>

Is it possible to manipulate the inner svg elements from a script defined in
the outer? I tried

var SVGDoc = evt.getTarget() .getOwnerDocume nt();
var SVGRoot = SVGDoc.getDocum entElement();
var SVGInner = SVGDoc.getEleme ntsByTagName("s vg");
SVGInner.curren tTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget() .getOwnerDocume nt();
var SVGRoot = SVGDoc.getDocum entElement();
SVGRoot.current Translate.x += dx;

then the entire outer document gets translated, I've also tried
SVGDoc.getEleme ntByID and getfirstChild with no luck... can someone point me
in the right direction?


Do you know about the Yahoo group for SVG developers? Maybe someone
there can answer your question
http://groups.yahoo.com/group/svg-developers/
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2824
by: Rob Meade | last post by:
Hi all, I went on an XML course over a year ago and have finally got around to having a use for it, but do you think I can actually remember anything - nope!.. Ok, here's what I want to do - I want to store an XML file with several elements that contain data for applications we've written - its going to be used by people in our team as a portfolio to show people when
1
1983
by: wooks | last post by:
I have some information embedded in included schemas which I want to access at run-time for the purposes of contructing a GUI (they will support field labels and tool tips). The options seem to be to store them as documentation/appinfo elements within the included schema or as unhandled attributes. Because the schemas are included it seems the items would have to be accessed via the SOM (as opposed to retrieving the details via XPATH)...
4
1865
by: Julius Mong | last post by:
Dear all, I have something like this: <html... > <embed ...> </html> Am I out of luck if I wanted to access the embedded DOM and manipulate its content? Or if I have:
5
2452
by: Craig Anderson | last post by:
Can anyone tell me the best way to access a hidden object in a form? I could use a hard-coded index to the elements of the form, but it's too easy to add something before the hidden object and mess up the indexing. For example: The form has a tagid of "myForm" The hidden object has a tagId of "myHiddenObj"
6
2746
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
7
1258
by: James A | last post by:
Hi, I'm having trouble geting my head around this, although I know it's a pretty basic question. I have an application whereby an area of RAM is mapped to an array: unsigned char NV; Two consequtive elements are used to hold an unsigned int (2 bytes on this
1
3134
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created elements and would like to seek a solution for this. I had looked through several articles for accessing programatically-created dynamic elements such as: 1)
7
1879
by: ian ward | last post by:
Hello, I want to show the result of some JavaScript on an HTML page. I've had a look at some threads and it seems the conclusion is the following - javascript entities are usable on the right-hand side of attribute/value pairs (with some appropriate syntax involving curly brackets and ampersands) and, furthermore, this only works for attributes of "link type" html elements. If this is the case then I'm a bit stuck, but I'd like to...
3
10521
by: judy.j.miller | last post by:
Does anyone know why i can't access a form element value using dot notation in firefox, when i'm in a function. Works ok in the body. I'm trying to do this: var FarTemp = faren.temp.value; I can get at the value using the array method, the getelements by id method, and the bracket-with-the-element-name in it method. But the dot notation doesn't work, in firefox, in the function (which i have in the head).
0
9345
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,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9905
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,...
0
8780
agi2029
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...
1
7332
isladogs
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...
0
6609
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();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.