Hello,
I'm a avid greasemonkey user, with different scripts for many pages. I
decided a while back I wanted to create a simple script which I could
use to help as a addon for a webpage to increase creativity. Not
having any previous knowledge of creating scripts I read the book and
I have tried to follow guides.
All i want to find out is how to add a button onto a page, which when
clicked outputs a small code into a text box already on the page. This
will help on the website I use.
i.e.
image button.
When you click [img][/img] is given out.
I've tried a few tutorials and the current one I'm on is this:
// Inserts javascript that will be called by the autoCheckOrderButton
var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.innerHTML = 'function checkForOrders() { alert("inside
checkForOrders"); }';
document.getElementsByTagName("head")[0].appendChild(scriptElement);
window.addButton = function () {
// Get the location on the page where you want to create the button
var targetDiv = document.getElementById('offer');
// Create a div to surround the button
var newDiv = document.createElement('div');
newDiv.setAttribute('id', 'autoCheckOrder');
// Create the button and set its attributes
var inputButton = document.createElement('input');
inputButton.name = 'autoCheckOrderButton';
inputButton.type = 'button';
inputButton.value = 'Start Checkin';
inputButton.setAttribute("onclick", "checkForOrders();");
// Append the button to the div
newDiv.appendChild(inputButton);
targetDiv.appendChild(newDiv);
}
addButton();
Thanks in advance,
Niall
--
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.