gpt4 book ai didi

html - 在元刷新时提交表单?

转载 作者:行者123 更新时间:2023-11-27 22:48:59 25 4
gpt4 key购买 nike

是否可以提交表单并在元刷新上发布一些数据??

我有一些 html,我想在 5 秒后提交,但我不希望用户必须单击提交按钮 - 这可能吗?

我在下面开始了一些代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="refresh" content="5;url=http://www.mysite.com" />
<title>Test Post</title>
<base href="http://www.mysite.com" />
</head>
<body>

<form action="http://www.mysite.com" method="post">
<input type="hidden" name="fname" value = "paul"/>
<input type="hidden" name="age" value = "25"/>

</body>
</html>

最佳答案

我认为唯一的方法是使用 javascript:

<script>
setTimeout(function() {
document.forms[0].submit();
}, 5000);
</script>

关于html - 在元刷新时提交表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5246322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com