Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reference to Sidebar

2 views
Skip to first unread message

shawn...@gmx.de

unread,
Apr 1, 2007, 10:09:00 AM4/1/07
to
I have created a Firefox sidebar extension that displays correctly,
but
I can't get my JavaScript to reference the objects in it to make
updates to the content.

I tried document.getElementById("sidebar") but it does not work. I
already tried to call it in a function where I used
document.setInterval() to call the function because that solved my
last problem (thanks to this group).

I think that I'm referencing the wrong document. Is that possible? But
I dont know how to change the document so I can reference the
sidebar's document.


thanks,
Rhapsody

John P Baker

unread,
Apr 1, 2007, 11:37:47 AM4/1/07
to
In message <1175436540.7...@n76g2000hsh.googlegroups.com>
shawn...@gmx.de wrote:

I've only done it once, copying someone elses code, but I think you need its
contentDocument:

get _sidebar() {
var sidebar = document.getElementById("sidebar");
if (sidebar && sidebar.getAttribute("src") == "chrome://foo/content/sidebar.xul")
return sidebar.contentDocument;
return null;
}

john
--
John P Baker

gmgj

unread,
Apr 6, 2007, 9:42:27 AM4/6/07
to
This works for me. I load the xul into the sidebar.
I give the element an ID

<textbox id="gj53runSearch" flex="1" style="font-size:10pt; " />

and then I just do a normal call
var field=document.getElementById('gj53runSearch');

0 new messages