Wednesday 15 February 2012

javascript - Script not working for search page and click link -



javascript - Script not working for search page and click link -

i have next script

<script> settimeout(function() { window.location.reload(); }, 2000); // 2 seconds, e.g. $('a:contains("13468100")').closest('tr').find('.fightactioninnerinner').click(); </script>

the page has iframe on it. script supposed search contents of iframe links contain number 13468100 , clicks tr next id of 'fightactioninnerinner', refreshing page every 2 seconds.

the refresh function works, script doesn't seem click link, though know it's there.

also, i'd have input box user can input require script search for. example: if want search link containing "david", can type david text box , amends script.

this html asking script search

<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>

i think improve more simple search query be:

$(".fightactioninnerinner a:contains('13468100')").click();

this describing script. find tr class (i think meant class not id alter . # if wanted id) has link kid containing whatever want.

to create custom need add together variable:

var name = $("#input_id").val();

and append query:

$(".fightactioninnerinner a:contains('" + name + "')").click();

javascript

No comments:

Post a Comment