怎么自动点击input提交按钮,用js
<tdheight="57"width="35%"></td><tdheight="57"width="64%"> <inputtype="submit"nam...
<td height="57" width="35%"> </td>
<td height="57" width="64%"> <input type="submit" name="0MKKey" value="登录" onClick="cc(0)" class="login-b" onMouseOver="this.className='login-b2'" onMouseDown="this.className='login-b3'" onMouseOut="this.className='login-b'"/> 展开
<td height="57" width="64%"> <input type="submit" name="0MKKey" value="登录" onClick="cc(0)" class="login-b" onMouseOver="this.className='login-b2'" onMouseDown="this.className='login-b3'" onMouseOut="this.className='login-b'"/> 展开
1个回答
2019-06-13
展开全部
HTML元素对象调用click()函数,就会触发元素的点击事件。
<form>
<input id="it" type="submit" value="submit" onclick="test()"/>
</form>
<script>
var it=document.getElementById("it");
it.click();
</script>
<form>
<input id="it" type="submit" value="submit" onclick="test()"/>
</form>
<script>
var it=document.getElementById("it");
it.click();
</script>
更多追问追答
追问
我写的跟你差不多,但没法运行
var z = document.getElementsByClassName('login-b')[index];
z.click();
追答
你的index是什么?直接写0不行么?
var z = document.getElementsByClassName('login-b')[0];
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询