有点困惑。我正在尝试搜索iframe的内容并点击其中的链接。链接是'Attack'。找到最接近的tr ...脚本搜索祖先?
<script>
setTimeout(function() { window.location.reload(); }, 1000); // 1 seconds, e.g.
$(document).ready(function() {
$('a[href*="5562089"]', $("game").contents()).closest('tr').find('.fightActionInnerInner').parent("a").trigger("clic k");
});
</script>
<iframe src="http://vl.storm8.com/hitlist.php" width="100%" height="800px" id="game"></iframe>
这里是我想与之交互的iframe中的HTML。
<td class="fightMobster">
<div>
<a href="/profile.php?puid=5562089&formNonce=34947b8ffc73e8ceafabae71…94f&setTab1Badge=&h=2d55f5781bfe888b47d7f5c9dbc27df2f663347f">
Lord Pookie
</a>
</div>
<div>
Lvl 212 Daywalker
</div>
</td>
<td class="fightSp"></td>
<td class="fightMobSize">
<span class="cash">
<span style="white-space: nowrap;">
<img width="15" height="14" style="padding-right:2px" src="http://static.storm8.com/zl/images/flesh.png?v=330"></img>
15,300
</span>
</span>
</td>
<td class="fightSpLg"></td>
<td class="fightAction">
<script>
function fsb99995143() {
var b=…
</script>
<a onclick="return fsb99995143();" href="/hitlist.php?tab=fight.php&action=fight&hitlistId=99995143&f…1b4b9390bee9a194f&h=284e4fe4946e6fb8af3a662f4583454eebc8bd23">
<div class="fightActionInner">
<div class="fightActionInnerInner">
Attack
</div>
我很困惑。脚本刷新页面,但似乎不想单击那里的链接。我究竟做错了什么?
尝试更换“准备”与“载“in $(document).ready – 2014-11-05 11:46:33
那么你有一个超时重新加载页面....看起来很奇怪。 – epascarello 2014-11-05 11:49:25
@FrederikWitte感谢您的回复,但之后仍然没有变化我害怕:( – AdamH 2014-11-05 11:49:56