zoukankan      html  css  js  c++  java
  • JavaScript动态修改html组件form的action属性

    用javaScript动态修改html组件form的action属性,可以在提交时再决定处理表单的页面。

    <%--JavaScript部分--%>
    <script language="javascript">
        <%--略掉其余代码--%>
        if(usertypevalue=="company"){
             document.form.action="./company.jsp"
             document.form.submit();
        }
         else if(usertypevalue=="user"){
            document.form.action="./user.jsp"
             document.form.submit();
         }
         else if(usertypevalue=="tourism"){
             document.form.action="./tourism.jsp"
             document.form.submit();
         }
        <%--略掉其余代码--%>
    </script>

    <%--html部分代码--%>
    <form name="form" id="form" action="" method="post">    
         <%--略掉其余代码--%>    
         <input type="radio" name="usertype" id="usertype" value="tourism">旅游局
        <input type="radio" name="usertype" id="usertype" value="company">公司
        <input type="radio" name="usertype" id="usertype" value="user" checked="checked">游客        
        <br>
        <input type="button" value="确认" onclick="validate();">
        <input type="reset" value="重置">
            <%--略掉其余代码--%>
    </form>

    这样就可以在检查用户信息后,把参数用post方法传给另一不确定jsp页面

  • 相关阅读:
    《通往衰败之路》读后感 读书笔记
    《苏世民我的经验与教训》读后感 读书笔记
    《红星照耀中国》读后感 读书笔记
    《上帝之子》读后感 读书笔记
    《两兄弟》读后感 读书笔记
    《好的经济学》读后感 读书笔记
    JSON 使用 教程
    JSON 使用
    JSON 语法
    Json
  • 原文地址:https://www.cnblogs.com/winstonet/p/6916278.html
Copyright © 2011-2022 走看看