Take a look at pitfall #2 [1] in Mark Pilgrim's "Avoid Common Pitfalls in Greasemonkey" [2]
[1] - http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Pitfall_.232:_Event_Handlers [2] - http://wiki.greasespot.net/Avoid_Common_Pitfalls_in_Greasemonkey On 12 March 2010 19:45, Jose Manuel <[email protected]> wrote: > Hello. > > I'd like to call a function in the onclick event. > What's the problem??? > > Thanks!! > > My code is: > > function borralog(){ > document.getElementById('divnotas').innerHTML = ""; > } > function loguea(texto){ > document.getElementById('divnotas').innerHTML += texto + "<br>"; > } > /* I've tried... > window.recolecta = function() { // it didn't > work */ > function recolecta(){ // it didn't work too > alert ("hola"); > borralog(); > loguea ("recolectando información"); > } > > > // crear capa de información > fi = document.getElementById('links'); > contenedor = document.createElement('div'); > contenedor.id = 'divnotas'; > fi.appendChild(contenedor); > document.getElementById('divnotas').style.color = "red"; > document.getElementById('divnotas').style.background = "#000000"; > > //Crear botón extractor de información > document.getElementById('divnotas').innerHTML = '<input type=button > value="Recolectar info" onClick = "recolecta();" >'; > > -- > You received this message because you are subscribed to the Google Groups > "greasemonkey-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/greasemonkey-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
