开发者

.submit() doesn't work with Firefox and Greasemonkey

开发者 https://www.devze.com 2022-12-23 16:32 出处:网络
I\'m trying to make an auto login script and I\'m stuck on the submit part... The source of the submit form from the website is

I'm trying to make an auto login script and I'm stuck on the submit part...

The source of the submit form from the website is

<input type="submit" v开发者_Python百科alue="Sign In" class="signin" id="sumbitLogin">

and I'm trying

document.getElementById("sumbitLogin").submit();

if I set an Attribute, for example the value, it changes just fine...

How can I solve it?


You don't submit an input field. You submit a form.

<form id="formid">
<input type="submit" value="Sign In" class="signin" id="sumbitLogin">
</form>

and ..

document.getElementById("formid").submit();


Use form_name.submit()

<form id='myform' action='formmail.pl'>

Here is the code to submit a form when a hyperlink is clicked:

<form name="myform" action="handle-data.php">
Search: <input type='text' name='query' />
<a href="javascript: submitform()">Search</a>
</form>
<script type="text/javascript">
function submitform()
{
  document.myform.submit();
}
</script> 
0

精彩评论

暂无评论...
验证码 换一张
取 消