[beginner]toolbar - getElementById - Mozilla

This is a discussion on [beginner]toolbar - getElementById - Mozilla ; Hello I would like to create a firefox extension which hava just a toolbar which chages color. I try something like this: Code: .... oncommand="colorize('background-color:red');" / > oncommand="colorize('background-color:yellow');"/ > Problem is that getElementById always returns me null!!! Where is my ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [beginner]toolbar - getElementById

  1. [beginner]toolbar - getElementById

    Hello I would like to create a firefox extension which hava just a
    toolbar which chages color. I try something like this:

    Code:

    ....





    oncommand="colorize('background-color:red');" /
    >

    oncommand="colorize('background-color:yellow');"/
    >







    Problem is that getElementById always returns me null!!!

    Where is my error?

    Thanks for any help

    PS Is it posible to run java (not javascript) program from firefox
    extension?


  2. Re: [beginner]toolbar - getElementById

    On 3 Apr 2007 01:50:12 -0700, Piotr.Czechumski@gmail.com
    wrote:
    > var Tag = window.document.getElementById('worktoolbar');


    Note, "Tag" starts with a capital letter. Also, you can just use
    document.getElementById (as document == window.document).

    >
    > if (Tag)
    > {
    > tag.setAttribute("style",newStyle);


    Here "tag" is all-lowercase.

    >


    Is this a browser.xul overlay? This id-less will create a
    new and append it to the end of the master document, instead
    of inserting toolbars in the existing toolbox. Is that what you want?

    After fixing the above problems check if you have the with
    the right id in the DOM inspector.

    > Problem is that getElementById always returns me null!!!
    >
    > Where is my error?
    >

    And if you still can't figure it out, post the exact code you're using
    and the exact error message.

    Also, changing the background color might not work unless you reset
    -moz-appearance to none for the element.

    > PS Is it posible to run java (not javascript) program from firefox
    > extension?
    >

    The question is not clear. You can run external executables, there's
    JavaXPCOM (which I believe is not enabled in Firefox), and there's
    another way mentioned on MDC (searching it for "Java" should help).

    Nickolay

+ Reply to Thread