I have a bunch of buttons on a page that I want to cause to open in a new tab because I'm on dialup and I hate having to hit the back button and wait for the page to load again before I can click the next button.
The button code looks like this:
<button onclick="window.location.href='?act=stock&i=273';return false;" class="wide">Stock in Shop</button>
<button onclick="window.location.href='?act=stock&i=287';return false;" class="wide">Stock in Shop</button>
<button onclick="window.location.href='?act=stock&i=193';return false;" class="wide">Stock in Shop</button>
I think I somehow need to change window.location.href
to window.open()
and the URL to start with http://www.felisfire.com/possessions?
then add the href part from the original onclick... but I have no idea how to go about this and searching 3 hours for answers hasn't helped...
Please! How would I change those buttons with Greasemonkey?
Possible code so far, but I don't think it works:
var buttons = document.getElementsByClassName('wide');
for (var i = 0; i < buttons.length; i++) {
buttons[i]=button.onclick="window.open('http://www.felisfire.com/possessions + *how do I get the part I need from the original onclick?*');">Stock in Shop</button>
}