这个是我要点击的 <a href="#" class="treasureMapPopup-action-button highlight" onclick="app.views.TreasureMapView.map.discard(this); return false;">Leave</a>但是因为其他地方也有 类似的 class比如有个<a class="treasureMapPopup-action-button highlight" href="#" onclick="app.views.TreasureMapView.map.toggleTabState('upgradeMap'); return false;">UPGRADE</a>然后我想点击leave 怎么写啊 论坛上告诉我 var poster=document.getElementsByClassName('treasureMapPopup-action-button')
for(var i=0;i<poster.length;i++)if(poster[i].innerHTML=='Leave'){poster[i].onclick();break;}但是我直接复制进JS 好像不行 应该怎么写
for(var i=0;i<poster.length;i++)if(poster[i].innerHTML=='Leave'){poster[i].onclick();break;}但是我直接复制进JS 好像不行 应该怎么写
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
#div {}
</style>
</head>
<body><a href="#" class="treasureMapPopup-action-button highlight" onclick="alert(555); return false;">Leave</a><a class="treasureMapPopup-action-button highlight" href="#" onclick="app.views.TreasureMapView.map.toggleTabState('upgradeMap'); return false;">UPGRADE</a>
<script type="text/javascript">
var poster=document.getElementsByClassName('treasureMapPopup-action-button')
for(var i=0;i<poster.length;i++)if(poster[i].innerHTML=='Leave'){poster[i].onclick();break;}</script>
</body>
</html>
我直接复制进我的脚本好像就不行
function ClawShotCity(){
if(GetCurrentLocation().indexOf('Claw Shot City') < 0)
return; var cheeseArmed = getPageVariable('user.bait_name');
if(cheeseArmed.indexOf('Checkmate') < 0)
checkThenArm(null, 'bait', 'gouda);
window.setInterval(function () { fireEvent(document.getElementsByClassName('open active_poster')[0], 'click'); }, 5000);
window.setInterval(function () { fireEvent(document.getElementsByClassName('treasureMapPopup-cancel')[0], 'click'); }, 5000);
上面2个是点击 就缺最后个了