zoukankan      html  css  js  c++  java
  • 表单提交方式

    表单提交方式
                * 使用submit提交
                        <form>
                                .....
                               <input type="submit" />
                        </form>

                * 使用button提交表单
                         - 代码
                           //实现提交方法
                            function form1() {
                                  //获取form
                                  var form1 = document.getElementById("form1");
                                  //设置action
                                  form1.action = "hello.html";
                                  //提交form表单
                                  form1.submit();
                             }

                * 使用超链接提交
                            - 代码
                             <a href="hello.html?username=123456">使用超链接提交</a>

                * onclick:鼠标点击事件
                   onchange:改变内容(一般和select一起使用)

                   onfocus:得到焦点 (ie5、某些版本的ie6)
                   onblur:失去焦点

    <body>
        <form id="form1" >
            <input type="text" name="username"/>
            <br/>
            <input type="button" value="提交" onclick="form1();"/>
        </form>
    
        <hr/>
    
        <a href="hello.html?username=123456">使用超链接提交</a>
    
        <hr/>
        <input type="text" id="id1" name="text1" value="please input" onfocus="focus1();" onblur="blur1();"/>
     </body>
     
     <script type="text/javascript">
        //得到焦点
        function focus1() {
            //alert("foucus.");
            var input1 = document.getElementById("id1");
            input1.value = "";
        }
    
        //失去焦点
        function blur1() {
            //alert("blur.");
            var input1 = document.getElementById("id1");
            input1.value = "please input";
        }
    
        //实现提交方法
        function form1() {
            //获取form
            var form1 = document.getElementById("form1");
            //设置action
            form1.action = "hello.html";
            //提交form表单
            form1.submit();
        }
            
     </script>
  • 相关阅读:
    扫描线算法模板
    spark submit 常用设置
    networkx 画有向图 使用DiGraph
    超实用的Spark数据倾斜解决
    解决spark中遇到的数据倾斜问题
    TrickBot 恶意木马软件
    windows 打开snappy文件 安装python snappy——还是直接用pip install xx.whl 打包好的安装吧
    解决CentOS删除文件后没有释放磁盘空间(lsof命令)
    Linux 系统下 centOS 7 ipconfig 提示没有安装
    tomcat启动报错org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http...
  • 原文地址:https://www.cnblogs.com/sunli0205/p/6026715.html
Copyright © 2011-2022 走看看