<!DOCTYPE html>
<html>
<head>
    <title>弹出框示例</title>
    <style>
        #myModal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgb(0,0,0);
            background-color: rgba(0,0,0,0.4);
        }
<pre><code>    .modal-content {
        background-color: #fefefe;
        margin: 15% auto;
        padding: 20px;
        border: 1px solid #888;
        width: 80%;
    }
    
    .close {
        color: #aaa;
        float: right;
        font-size: 28px;
        font-weight: bold;
    }
    
    .close:hover,
    .close:focus {
        color: black;
        text-decoration: none;
        cursor: pointer;
    }
&lt;/style&gt;
</code></pre>
</head>
<body>
    <h2>点击按钮弹出框</h2>
    <button onclick="openModal()">打开弹出框</button>
<pre><code>&lt;!-- 弹出框 --&gt;
&lt;div id=&quot;myModal&quot;&gt;
    &lt;div class=&quot;modal-content&quot;&gt;
        &lt;span class=&quot;close&quot; onclick=&quot;closeModal()&quot;&gt;&amp;times;&lt;/span&gt;
        &lt;h3&gt;表单提交&lt;/h3&gt;
        &lt;form action=&quot;submit.php&quot; method=&quot;post&quot;&gt;
            &lt;label for=&quot;name&quot;&gt;姓名:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;name&quot; required&gt;&lt;br&gt;&lt;br&gt;
            
            &lt;label for=&quot;address&quot;&gt;地址:&lt;/label&gt;
            &lt;select id=&quot;address&quot; name=&quot;address&quot;&gt;
                &lt;option value=&quot;北京&quot;&gt;北京&lt;/option&gt;
                &lt;option value=&quot;上海&quot;&gt;上海&lt;/option&gt;
                &lt;option value=&quot;广州&quot;&gt;广州&lt;/option&gt;
                &lt;option value=&quot;深圳&quot;&gt;深圳&lt;/option&gt;
            &lt;/select&gt;&lt;br&gt;&lt;br&gt;
            
            &lt;label for=&quot;file&quot;&gt;文件上传:&lt;/label&gt;
            &lt;input type=&quot;file&quot; id=&quot;file&quot; name=&quot;file&quot;&gt;&lt;br&gt;&lt;br&gt;
            
            &lt;label for=&quot;gender&quot;&gt;性别:&lt;/label&gt;
            &lt;input type=&quot;radio&quot; id=&quot;male&quot; name=&quot;gender&quot; value=&quot;male&quot;&gt;
            &lt;label for=&quot;male&quot;&gt;男&lt;/label&gt;
            &lt;input type=&quot;radio&quot; id=&quot;female&quot; name=&quot;gender&quot; value=&quot;female&quot;&gt;
            &lt;label for=&quot;female&quot;&gt;女&lt;/label&gt;&lt;br&gt;&lt;br&gt;
            
            &lt;label for=&quot;hobby&quot;&gt;爱好:&lt;/label&gt;
            &lt;input type=&quot;checkbox&quot; id=&quot;hobby1&quot; name=&quot;hobby[]&quot; value=&quot;reading&quot;&gt;
            &lt;label for=&quot;hobby1&quot;&gt;阅读&lt;/label&gt;
            &lt;input type=&quot;checkbox&quot; id=&quot;hobby2&quot; name=&quot;hobby[]&quot; value=&quot;music&quot;&gt;
            &lt;label for=&quot;hobby2&quot;&gt;音乐&lt;/label&gt;
            &lt;input type=&quot;checkbox&quot; id=&quot;hobby3&quot; name=&quot;hobby[]&quot; value=&quot;sports&quot;&gt;
            &lt;label for=&quot;hobby3&quot;&gt;运动&lt;/label&gt;&lt;br&gt;&lt;br&gt;
            
            &lt;input type=&quot;submit&quot; value=&quot;提交&quot;&gt;
        &lt;/form&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
    // 打开弹出框
    function openModal() {
        document.getElementById(&quot;myModal&quot;).style.display = &quot;block&quot;;
    }

    // 关闭弹出框
    function closeModal() {
        document.getElementById(&quot;myModal&quot;).style.display = &quot;none&quot;;
    }
&lt;/script&gt;
</code></pre>
</body>
</html
写一段html代码要求点击按钮弹出框弹框内容是一个表单提交里面包含input输入框地址选择器文件上传和单选以及多选按钮

原文地址: http://www.cveoy.top/t/topic/iVPI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录