Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Greasemonkey] "showit is not defined"
wszerad
post
Post #1





Grupa: Zarejestrowani
Postów: 106
Pomógł: 18
Dołączył: 11.12.2008

Ostrzeżenie: (0%)
-----


Napisałem kod i po kliknięciu na diva w Firebugu wyskakuje mi:
  1. showit is not defined
  2. function onclick(event) { showit(); }(click clientX=494, clientY=508)

Wie ktoś dlaczego? pewnie powód jest banalny ale nie mogę go znaleźć.
  1. // ==UserScript==
  2. // @name wowhead
  3. // @namespace wszerad91@wp.pl
  4. // @include <a href="http://www.wowhead.com/?spell=*" target="_blank">http://www.wowhead.com/?spell=*</a>
  5. // ==/UserScript==
  6. function showit()
  7. {
  8. alert('test');
  9. }
  10.  
  11. space = document.getElementById('jkbfksdbl4').childNodes[0].childNodes[1].childNodes[2].childNodes[0];
  12. li = document.createElement('li');
  13. a = document.createElement('a');
  14. b = document.createElement('b');
  15. div = document.createElement('div');
  16. text1 = document.createTextNode('i jak?');
  17. text2 = document.createTextNode('i jak?');
  18. div.setAttribute('onclick','showit();');
  19. div.appendChild(text1);
  20. b.appendChild(text2);
  21. a.appendChild(div);
  22. a.appendChild(b);
  23. li.appendChild(a);
  24. space.appendChild(li);

Tak przy okazji czy greasemonkey jest jakoś ograniczony w kodzie? Tz. czy czegoś nie da się zrobić co oferuje JS i jest dostępne do zrobienia na stronie?

Tak na przyszłość to setAttribute trzeba zastąpić przez AddEventListener.
Go to the top of the page
+Quote Post

Posty w temacie
- wszerad   [Greasemonkey] "showit is not defined"   19.10.2009, 19:23:33


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 14:46