Html5:表单验证&x27;必需的';不起作用

Html5:表单验证&x27;必需的';不起作用,html,forms,Html,Forms,好的,我正在为一个网站做一个表格,我遇到了一个问题。因此,当我尝试在html5中验证表单时,它无法正常工作。我不知道我是否需要做点什么。我想让它这样当我提交按钮,然后它会显示错误。但它没有进入下一页 我不知道该怎么办,有人能帮我吗 这是表格 <form> <strong> <p style="color:#63bbff">First Name: </strong> <input type="text" name=

好的,我正在为一个网站做一个表格,我遇到了一个问题。因此,当我尝试在html5中验证表单时,它无法正常工作。我不知道我是否需要做点什么。我想让它这样当我提交按钮,然后它会显示错误。但它没有进入下一页

我不知道该怎么办,有人能帮我吗

这是表格

<form>
   <strong>
      <p style="color:#63bbff">First Name:
   </strong>
   <input type="text" name="name" required ><br /></p>
   <strong>
      <p style="color:#63bbff">Minecraft Username(IGN):  
   </strong>
   <input type="text" name="ign" required ><br /></p>
   <strong>
      <p style="color:#63bbff">Age: 
   </strong>
   <input type="text" name="age" required ><br /></p>
   <em>
      <p style="color:#63bbff">When you understand the stated above, and ready to continue, click the button 'Continue'
      <p>
   </em>
   <input type="submit" class="button" value="Continue" onclick="window.location='Index-3.html'" class="btn">
</form>
<button class="button" onclick="window.location='Index.html'">Previous</button>


姓名:


Minecraft用户名(IGN):

年龄:

了解上述内容并准备好继续后,单击“继续”按钮 以前的


好的,您需要在Submit上编写表单

<form onsubmit="Index-3.html" >

并从“提交”按钮中删除窗口位置。检查演示

只需使用
和提交字段,如下所示:

<input type="submit" class="button" value="Continue" class="btn">
演示:

只需使用
和提交按钮:

<input type="submit" class="button" value="Continue" class="btn">


演示:

请将onclick=“window.location='Index-3.html'”替换为onsubmit=“window.location='Index-3.html'”

您并没有提交表单,而是使用一段令人讨厌的JavaScript重定向到单独的页面。。。即使表单无效,您也可以无条件运行该代码。请注意,您有
->您应该将
放在
中。但这不是问题所在。如前所述,submit按钮上的
onclick
实际上并没有提交表单。您可以使用
submit()
javascript函数,也可以不使用javascript来提交表单
<input type="submit" class="button" value="Continue" class="btn">