我在下面有一个按钮示例
<button id="startrunning">go</button>
我在同一页面 java 脚本上没有使用任何表单或任何东西来检测它的点击。当我点击它时,它会像我想要的那样工作。我想看看当页面加载时它会自动提交它自己有没有办法?
谢谢
最佳答案
jsFiddle:http://jsfiddle.net/QEu84/10/
<script type="text/javascript">
function submit()
{
document.getElementById("startrunning").click(); // Simulates button click
document.submitForm.submit(); // Submits the form without the button
}
</script>
<body onload="submit()">
<form id="submitForm">
<button id="startrunning">go</button>
</form>
</body>
关于javascript - HTML 按钮加载提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10364749/