[beginner]toolbar - getElementById

View: New views
1 Messages — Rating Filter:   Alert me  

[beginner]toolbar - getElementById

by Jurkil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Code:

...
<script type="application/x-javascript" >

function colorize(newStyle)
{
  var Tag = window.document.getElementById('worktoolbar');
 
  if (Tag)
  {
    tag.setAttribute("style",newStyle);
  }
  else
  {
    alert("error");
  }
 
}
</script>

<toolbox>
 <toolbar id="worktoolbar" style = "background-color:yellow" >
      <toolbarbutton label="Color:" />
      <toolbarbutton type="radio" name="color" label = "red"
                     oncommand="colorize('background-color:red');" />    
      <toolbarbutton type="radio" name="color" label="yellow"
                     oncommand="colorize('background-color:yellow');"/>    
    </toolbar>
 </toolbox>

</overlay>


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?
LightInTheBox - Buy quality products at wholesale price