(sorry for double post) Andreas Gohr wrote (very fast indeed): > > hmm... shouldn't this be xid[0] for the first found element? Yep, of course >> The problem is though that apparently the document is not yet loaded >> when userscript.js gets evaluated. So the xid[] array will always be >> empty. > > You need to wait till the document is loaded and then execute you > script. To do so use the addInitEvent call. Something like this should > work (untested): > > function my_toolbar_additions() { > if(!toolbar) return; > var xid = document.getElementsByName("id"); > var ns=xid[0].value; > var open = "[["+ns+":"; > toolbar[toolbar.length] = {"type":"format", > "title":"newpage_below", > "icon":"below.png", > "key":"", > "open":open, > "close":"]]"}; > } > addInitEvent(my_toolbar_addition); Yes this works, but you have to re-init the toolbar by calling initToolbar and you'll end up with two toolbars because you add an element to the array and parse it twice then. Three options here: - Remove the "button divs" in DOM and re-init the toolbar? - Add child elements to the toolbar? - Rewrite initToolbar to include only last (added) elements? what is nice to do here? Can someone help me out here? Riny -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist