Newbie question on XUL and JavaScript

How do I detect when the URL changes? I need to put it as a label in a navigation toolbar button. I've tried this code

content.document.addEventListener("load", nuevaPagina(), false);

function nuevaPagina(){

var boton2 = null;

var boton2 = document.getElementById("myextension-button2");
boton2.label = content.document.location;
}

But it doesn't seem to work...
[432 byte] By [cespinoza1979] at [2007-11-20 10:55:38]
# 1 Re: Newbie question on XUL and JavaScript
****! Every time I post a question, I find the answer after a couple of minutes! dev-archive is my new lucky charm :)

It was so simple:

in the overlay:

<script type="application/x-javascript">
<![CDATA[

var tb = document.getElementById("content");
if (tb) {
tb.addEventListener("load", nuevaPagina, true);
}

]]>

</script>

in the .js

function nuevaPagina(event){

var boton2 = null;
URLActual = content.document.location;
var boton2 = document.getElementById("myextension-button2");
if (boton2.disabled==false)
{
boton2.label = content.document.location;
}
}

The next question i'll post: How do I become a millionaire? lol
cespinoza1979 at 2007-11-8 0:43:08 >