dom.source.insert And dom.insertHTML

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default dom.source.insert And dom.insertHTML

    Hi,

    I?m needing to insert two code in page with a extension tha I?m creating. The
    first code stay inside the <head> tag, so I?m using that:

    dom.source.insert(doc.indexOf('</head>'), insertCodeScript);

    And the other code, will be insert in the position of the user page. So I?m
    using that:

    dom.insertHTML(insertCode);

    So, the Dreamweaver doens?t run the two code, when him (dw) insert the first
    (dom.source.insert....) it?s stop. I need to run the two code.

    How to do the Dreamweaver run the two code?




    Leandro_Brazil Guest

  2. Similar Questions and Discussions

    1. insertHTML won't work with XML files
      I am trying to create a command that writes text to an open XML file. The command I've created works fine under some circumstances but not others. ...
    2. insertHTML
      I'm trying to use the dom.insertHTML tag to insert a piece of code that contains an id attribute with the id specified. When I do this the id gets...
    3. INSERT statement contains fewer items than the insert list
      The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles...
    4. SCO, Open Source and the Un*x source code
      On Sat, Jul 19, 2003 at 04:51:08PM +0000, tony@aplawrence.com wrote: .... Isn't SCO claiming that they own all the Unix IP in the world :-). ...
    5. Insert PDF movie links from TeX source file?
      I prepare documents using TeX (Plain, not LaTeX), distill to PDF, then insert movie links (links to .mov files) by hand using Acrobat. If I know...
  3. #2

    Default Re: dom.source.insert And dom.insertHTML

    More details about the error specified above.

    In some tests, I did here, I could understand that:

    The extension is function perfect in the Code View only. But I?m using this
    code:

    function isDOMRequired() {
    // Return false, indicating that this object is available in code view.
    return false;
    }

    With I pretend that the extension, function in the Code View too, but the
    extension is function perfect only in this mode.

    Some idea?

    Leandro_Brazil Guest

  4. #3

    Default Re: dom.source.insert And dom.insertHTML

    Other strange thing:

    If I use the extension in the Design View, only the code inserted with this
    code:

    dom.source.insert(doc.indexOf('</head>'), insertCodeHead);

    appear in the HTML code. So if I execute Ctrl + Z the code inserted disappear
    (obviuos). So I change to the Design View, and the surprise: the code that must
    be inserted with this code:

    dom.insertHTML(insertCode);

    appear mysteriously.

    Hot to solve it?


    Leandro_Brazil Guest

  5. #4

    Default Re: dom.source.insert And dom.insertHTML

    beyond this code:
    dom.source.insert(doc.indexOf('</head>'), insertCodeHead);

    What the other i can insert a code inside the <head> tag?
    Leandro_Brazil Guest

  6. #5

    Default Re: dom.source.insert And dom.insertHTML

    Leanardo,

    You could also try this...

    var dom = dw.getActiveWindow();
    var dwHead = dom.getElementsByTagName('head');
    dwHead[0].innerHTML += 'Your Code to Insert';

    For the body it would be like this....

    var dom = dw.getActiveWindow();
    var dwBody = dom.getElementsByTagName('body');
    dwBody[0].innerHTML += 'Your Code to Insert';

    Note: This will add code to the body but will not place it at the cursor
    position.


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]







    "Leandro_Brazil" <webforumsuser@macromedia.com> wrote in message
    news:dkg71t$pec$1@forums.macromedia.com...
    > beyond this code:
    > dom.source.insert(doc.indexOf('</head>'), insertCodeHead);
    >
    > What the other i can insert a code inside the <head> tag?

    T.Pastrana - 4Level Guest

  7. #6

    Default Re: dom.source.insert And dom.insertHTML

    Pretty good. It solve my problem.

    I used that:

    var dom = dw.getActiveWindow();
    var dwHead = dom.getElementsByTagName('head');
    dwHead[0].innerHTML += 'Your Code to Insert';

    to insert the code inside the <head> tag. And the objecTag to insert the other
    code, in the cursor position :D.

    Now, only I question. What the diference between: var dom =
    dw.getActiveWindow(); and var dom = dw.getDocumentDOM();?

    Thanks.

    Leandro_Brazil Guest

  8. #7

    Default Re: dom.source.insert And dom.insertHTML

    Actually you should probably use dw.getDocumentDOM() as this will insert the
    code in the document where the cursor is whether your using a Frameset or
    not. Using dw.getActiveWindow() will place the code in the Frameset instead
    of the frame with the cursor inside of it.


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]






    "Leandro_Brazil" <webforumsuser@macromedia.com> wrote in message
    news:dkh0s7$1la$1@forums.macromedia.com...
    > Pretty good. It solve my problem.
    >
    > I used that:
    >
    > var dom = dw.getActiveWindow();
    > var dwHead = dom.getElementsByTagName('head');
    > dwHead[0].innerHTML += 'Your Code to Insert';
    >
    > to insert the code inside the <head> tag. And the objecTag to insert the
    > other
    > code, in the cursor position :D.
    >
    > Now, only I question. What the diference between: var dom =
    > dw.getActiveWindow(); and var dom = dw.getDocumentDOM();?
    >
    > Thanks.
    >

    T.Pastrana - 4Level Guest

  9. #8

    Default Re: dom.source.insert And dom.insertHTML

    Let me explain it a bit better.

    If your open document is not a Frameset there is no difference between
    dw.getDocumentDOM() and dw.getActiveWindow(). The results will be the same.

    If you are using a Frameset, dw.getActiveWindow() will insert the code
    inside of the Frameset, not any of the frames and dw.getDocumentDOM() will
    place the code in the frame which has focus, or the one where the cursor was
    when the extension was launched.


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]






    "T.Pastrana - 4Level" <aaaa@aaaa.com> wrote in message
    news:dkh1ao$28f$1@forums.macromedia.com...
    > Actually you should probably use dw.getDocumentDOM() as this will insert
    > the code in the document where the cursor is whether your using a Frameset
    > or not. Using dw.getActiveWindow() will place the code in the Frameset
    > instead of the frame with the cursor inside of it.
    >
    >
    > --
    > Regards,
    > ..Trent Pastrana
    > [url]www.fourlevel.com[/url]
    >
    >
    >
    >
    >
    >
    > "Leandro_Brazil" <webforumsuser@macromedia.com> wrote in message
    > news:dkh0s7$1la$1@forums.macromedia.com...
    >> Pretty good. It solve my problem.
    >>
    >> I used that:
    >>
    >> var dom = dw.getActiveWindow();
    >> var dwHead = dom.getElementsByTagName('head');
    >> dwHead[0].innerHTML += 'Your Code to Insert';
    >>
    >> to insert the code inside the <head> tag. And the objecTag to insert the
    >> other
    >> code, in the cursor position :D.
    >>
    >> Now, only I question. What the diference between: var dom =
    >> dw.getActiveWindow(); and var dom = dw.getDocumentDOM();?
    >>
    >> Thanks.
    >>
    >
    >

    T.Pastrana - 4Level Guest

  10. #9

    Default Re: dom.source.insert And dom.insertHTML

    Excellent explication.

    Now I understand the diference.

    Thanks.
    Leandro_Brazil Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139