嘿,谁能帮我
我想在页面加载时自动提交表单吗?
<form method='post' action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
答案 0 :(得分:0)
<form method='post' name="myForm" id="myForm" action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
window.onload=function(){
document.forms["myForm"].submit();
}
答案 1 :(得分:0)
您可以使用jquery来提交
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
document.getElementById("myDataForm").submit();
});
</script>
</head>
<body>
<form method='post' id="myDataForm" name="myDataForm" action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
</body>
</html>
请尝试这个。