36
rated 0 times
[
39]
[
3]
/ answers: 1 / hits: 12585
/ 11 Years ago, fri, december 6, 2013, 12:00:00
I'm trying to click on a submit button and submit a form using purely javascript. I have tried:
document.getElementById('sell_form').submit();
and
for(var i=0;i<document.getElementsByName('operation').length;i++){
if(document.getElementsByName('operation')[i].value=='Sell'){
document.getElementsByName('operation')[i].submit();
}
}
but I just can't get it. Can anyone show me how I could do this?
Thanks in advance.
The web code is:
<form id=sell_form class=ajaxform action=/member/sell method=post>
<div id=result class=popup> </div> //hidden
<div class=c-box-body>
<table width=100% border=0>
<div style=text-align:center>
<br>
<input type=hidden value=13 name=pair> //hidden
<input type=hidden value=Sell name=type> //hidden
<input type=submit value=Calculate name=calculate>
<input type=submit value=Sell name=operation> //**This is the one I'm trying to click on
<input type=reset value=Clear>
</div>
</div>
</form>
What makes this difficult is that the web page is not mine (I'm using greasemonkey in firefox which is essentially and onload javascript event)
More From » forms