Skip to main content
Stefan_Eike
Participant
December 6, 2011
Question

Pendant to document.getElementById

  • December 6, 2011
  • 2 replies
  • 1108 views

Hi,

sorry, I'm just starting learning FrameMaker ExtendScript, but I'm still stucking at the basics. I googled a lot, used the FM10 scripting guide, and so on but I didn't find a low-level tutorial for users like me, so I'd be glad, if you'd help me by answering some - hopefully - simple questions:

  • Is there a pendant to document.getElementById which returns a reference to an element by its ID in JavaScript.
  • (How) can I catch the parent XML element of an anchored graphic, if I grab the graphic element with FirstGrapicInDoc?

Sorry, I know asking questions that way isn't very welcome. But I'd be very glad, if you'd answer them anyway. I'm keen on writing a beginners tutorial for technical writers with basic XHTML+JavaScript skills.

Thanks a lot

Stefan

This topic has been closed for replies.

2 replies

Participating Frequently
December 7, 2011

Hi Stefan,

  1. If you trying to get an element based on @ID, there is no direct way.
  2. For an anchored graphic object (say, gph), you can get the parent XML element using - gph.Element.ParentElement.

Regards,

Tarun Garg

Adobe FrameMaker Engineering

December 6, 2011

Hi, Stefan,

There is not a direct analogue to the document.getElementById function because FrameMaker's document/object model is so fundamentally different than the HTML DOM. Depending on that you are trying to do, you would likely end up using doc.Find() for the relevant attribute/value pair. In a few circumstances, doc.getUniqueObject() might also be appropriate.

I have very limited experience moving XML into and out of Frame, so I'm feeling a bit speculative about your second question, but the first thing I would try would be myGraphic.FrameParent.Element.

For an introduction to many basic concepts, including the FM document model, I highly recommend Debra Herman's blog, Extending Framemaker.