Hi all!
I am making a greasemonkey script for the browser game The West. I am
trying to execute javascripts from buttons that I add to the page. How
do I do this? I have tried just adding the scripts to href, but this
don't work. I think that the "s in the script ends the link halfway.
Link to the script so far: http://userscripts.org/scripts/show/53319.
This is what I would like to do:
1. Make a button that executes the following script:
Code: Select all
javascript:(function(){%20var%20head%20=
%20document.getElementsByTagName('head').item(0);%20var%20old%20=
%20document.getElementById('TWIjs');%20if(old)%20head.removeChild
(old);
%20var%20js%20=%20document.createElement('script');%20js.setAttribute
('id',%20'TWIjs');%20js.setAttribute('language',%20'javascript');
%20js.setAttribute('type',%20'text/javascript');%20js.setAttribute
('src',%20'http://www.TheWestInsider.com/scripts/1.js.php');
%20head.appendChild(js);%20}%20)()
2. Make a button that executes the following scripts:
Code: Select all
javascript:var%20wsp_auth%20=
%20'&ui=148427&up=dee49110021552e7b73c9a3a3a6f5fc4fbfdd4b0';var
%20wsp_url%20=%20'www.weststats.com';var%20remoteScript=new%20Element
('script',%20{"type":%20"text/javascript",%20"src":%20"http://
www.weststats.com/js/import_all.js?1240671482"});document.body.appendChild(remoteScript);void(0);
and
Code: Select all
<a style="background:url(http://g.imagehost.org/0301/
weststats.jpg) no-repeat" href="http://www.weststats.com/?
change_world='+actual_world+'" target="_blank"></a>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---