我在一个页面上有一堆按钮,我想在新选项卡中打开,因为我正在拨号,我讨厌必须点击后退按钮并等待页面再次加载,然后才能单击下一个按钮.
按钮代码如下所示:
<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>
我想我需要以某种方式更改window.location.href
为window.open()
和开始的 URL,http://www.felisfire.com/possessions?
然后添加原始 onclick 中的 href 部分......但我不知道如何去做,搜索 3 小时的答案并没有帮助......
请!我将如何使用 Greasemonkey 更改这些按钮?
到目前为止可能的代码,但我认为它不起作用:
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>
}