2 Replies Latest reply on Dec 6, 2011 9:30 PM by TarunGarg(TG)

    Pendant to document.getElementById

    Stefan Eike



      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


        • 1. Re: Pendant to document.getElementById
          OliverJohn Level 2

          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.

          • 2. Re: Pendant to document.getElementById
            TarunGarg(TG) Level 1

            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.



            Tarun Garg

            Adobe FrameMaker Engineering