我正在为我玩的小游戏做一个脚本,我希望它在执行此代码后模拟输入按键...我研究了一下但无法找到任何东西:/任何人都可以帮助我吗?
if(parseInt(document.getElementById("premium_exchange_stock_wood").innerHTML)>64)
//document.forms[0].buy_wood.value=1;
document.forms[0].buy_wood.value=parseInt(document.getElementById("premium_exchange_stock_wood").innerHTML) ;
else if(parseInt(document.getElementById("premium_exchange_stock_stone").innerHTML)>64)
document.forms[0].buy_stone.value=parseInt(document.getElementById("premium_exchange_stock_stone").innerHTML) ;
else if(parseInt(document.getElementById("premium_exchange_stock_iron").innerHTML)>64)
document.forms[0].buy_iron.value=parseInt(document.getElementById("premium_exchange_stock_iron").innerHTML) ;
else(window.location = "https://br86.tribalwars.com.br/game.php?village=4317&screen=market&mode=exchange");
jQuery(":submit").click();
答案 0 :(得分:1)
尝试:
Html:
<input type="text" id="test"/>
Jquery的:
var e = jQuery.Event("keypress");
e.which = 13; //choose the one you want
e.keyCode = 13;
$("#test").trigger(e);