plugins - Would like to recup a string of a javascript function in a XUL code -


I am trying to do a plugin for Firefox in XUL language. So I got the information in Jason, I parse them and I can use the title in javascript. But I will use it in the XUL language

For example, in html, you can type: & lt; A href = "javascript: function ()" & gt; Link & lt; / A & gt; ; So I need to list each title in a menu label, but I would like to string it like my code like & lt; Menuitem label = "toto" /> function and do something like this: "menuitem label =" javascript: function (); "/>

I did not find anything in the internet, so I hope that I explain my problem and I hope someone can answer it. Thank you.


Ok thanks for your reply but I do not know exactly how to inject a new element with javascript in Toolbar, for example:

  And gt; & Lt; Button type = "menu" label = "see" & gt; & Gt; & Lt; Menupopup id = "pblist" & gt; & Gt; & Lt; Menuitem label = "toto" /> & Lt; / Menupopup & gt; & Lt; / Button & gt;  

So I have created a button view in a drop-down list in my toolbar and I will add a new dynamic label to my list, something like that but I do not know how to do this:

  & gt; & Lt; Script & gt; & Gt; Var list = document.createElement ("menupopup"); & Gt; Document.body.appendChild (list); & Gt; Menu.appendChild ('& lt; menuitem label = "titi" / & gt;'); & Lt; / Script>  

This does not work ... thanks for your help :)

Javascript: has a special meaning in the URL context ("Play this javascript code"). You can not use it in other places of HTML (like & lt; button label = "javascript: ..." & gt; ) For this reason you can not use it for the menu of the menu.

Your question is not specific to the XUL attribute, document .getElementById () and others to get the API ( element .setAttribute () ), The elements on the element are used in the attributes XUL element).


Comments