Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在一个页面上检查多个表单上的必填字段?_Javascript_Jquery_Html_Forms_Css - Fatal编程技术网

Javascript 如何在一个页面上检查多个表单上的必填字段?

Javascript 如何在一个页面上检查多个表单上的必填字段?,javascript,jquery,html,forms,css,Javascript,Jquery,Html,Forms,Css,我有一个包含以下内容的页面: <!DOCTYPE html> <html> <body> <form action="demo_form.asp"> Username: <input type="text" name="usrname" required> </form> <div class="map"></d

我有一个包含以下内容的页面:

<!DOCTYPE html>
    <html>
        <body>

        <form action="demo_form.asp">
          Username: <input type="text" name="usrname" required>
        </form>

        <div class="map"></div>
        <div><p>Some content to explain some things</p></div

        <form action="demo_form.asp">
          Username: <input type="text" name="lastusrname" required>
          <input type="submit">
        </form>

        <p><strong>Note:</strong> The required attribute of the input tag is not supported in Internet Explorer 9 and earlier versions, or in Safari.</p>

    </body>
</html>

用户名:
一些内容来解释一些事情

之所以有两个表单,是因为表单之间有其他html


您可以在表单中嵌入其他HTML—试试吧。两个
表单
元素的存在破坏了您的表单提交。

为什么您特别需要在这里有两个表单?如果你只是想在两者之间有一个映射,它可以位于表单标签中。我知道这可能是重新设计表单的正确方法,但我宁愿不这样做。以上就是一个例子。我有1000多行代码与表单混合在一起。有没有办法在不改变HTML结构的情况下实现这一点?这似乎是经典的ASP。考虑在打开和关闭<代码>窗体< /代码>标签中加入“<代码> >包含< /代码>。我只删除了第一个和最后一个结束标记之间的所有其他打开窗体和关闭窗体标签,它工作了,而不中断内容的外观或结构。非常感谢!