473,320 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
var SVGInner = SVGDoc.getElementsByTagName("svg");
SVGInner.currentTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
SVGRoot.currentTranslate.x += dx;

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

Thanks, Jules

Jul 20 '05 #1
1 2972


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().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
var SVGInner = SVGDoc.getElementsByTagName("svg");
SVGInner.currentTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
SVGRoot.currentTranslate.x += dx;

then the entire outer document gets translated, I've also tried
SVGDoc.getElementByID 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
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 -...
1
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...
4
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
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...
6
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...
7
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...
1
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...
7
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...
3
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.