• 21、在选择的时候跳到另一页面上,选择男女,然后提交表单内容



    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript">
        function check() {
            var tr = document.createElement("tr");
            var name = document.form1.name.value;
            var age = document.form1.age.value;
            var sex = document.form1.sex.value;
            tr.innerHTML = "<td>" + name + "</td><td>" + age + "</td><td>" + sex
                    + "</td>"
            window.parent.frames[2].document.getElementsByTagName("table")[0]
                    .appendChild(tr);
        }
    </script>
    </head>
    <body>
        <form name="form1" onsubmit="check()">
            姓名:<input type="text" name="name"><br /> 年龄:<input
                type="text" name="age"><br /> 性别:<input type="text"
                name="sex"><input type="button" value="选择"
                onclick="window.open('select.html')"> <input type="submit"
                value="提交">
        </form>
    </body>
    </html>


     

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    
    </head>
    <body>
        <select>
            <option>-----请选择-----</option>
            <option>男</option>
            <option>女</option>
        </select>
    </body>
    <script type="text/javascript">
        var select = document.getElementsByTagName("select")[0];
        select.onchange = function() {
            
                window.opener.document.form1.sex.value = this.options[this.selectedIndex].innerHTML;
                window.close();
        }
    </script>
    </html>
  • 相关阅读:
    velocity .vm
    @Autowired
    springMVC
    索引
    Adivisor
    计算火车运行的时间
    倒三角
    XML简介
    表单提交方式
    js动态生成表格
  • 原文地址:https://www.cnblogs.com/weizhen/p/5886988.html
Copyright © 2020-2023  润新知