·······表单自动提交·······

之前做网页的时候突然就在想能不能让表单自动提交,之后我尝试了一下

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>test</title>
</head>
<body>
    <form align="middle" method="post" action="**" name="test">
        <input type="hidden" value="" name="testt">
    </form>
    <script>document.getElementsByName("test").submit</script>
</body>
</html>

但是不论我怎么改代码都不会提交到指定页面,不知各位有什么解决办法呢

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>test</title>
</head>
<body>
    <form align="middle" method="post" action="**" id="test">
        <input type="hidden" value="" name="testt">
    </form>
    <script>document.getElementById("test").submit</script>
</body>
</html>

//将通过name获取标签改成id获取标签就可以了