它所做的是等到页面加载,找到快速回复按钮,单击它,找到文本区域,将其值更改为“bump”,单击快速回复按钮顺便说一句,问题不在 getElementsByAttribute 函数中,我复制了它来自我的另一个脚本,它在其中工作
window.onload=function(){
var t1=setTimeout(function(){getElementsByAttribute("src", "http://assets.bodybuilding.com/forum/bodybuilding/buttons/reply.gif")[0].click();},3000);
var t2=setTimeout(function(){getElementsByAttribute("class", "cke_source cke_enable_context_menu")[0].value = "bump";},3000);
var t3=setTimeout(function(){getElementsByAttribute("value", "Post Quick Reply")[0].click();},3000);
}
document.getElementsByAttribute = function( attrib, value, context_node, tag ) {
var nodes = [];
if ( context_node == null )
context_node = this;
if ( tag == null )
tag = '*';
var elems = context_node.getElementsByTagName(tag);
for ( var i = 0; i < elems.length; i += 1 ) {
if ( value ) {
if ( elems[i].hasAttribute(attrib) && elems[i].getAttribute(attrib) == value )
nodes.push(elems[i]);
} else {
if ( elems[i].hasAttribute(attrib) )
nodes.push(elems[i]);
}
}
return nodes;
}