JS动态改变form表单里的action值属性的方法
来源:互联网 发布:推女郎吧最新域名 编辑:程序博客网 时间:2024/05/01 10:58
前几天自己看了一个小程序,对form里的action值有所困惑,后来才明白其原理是动态改变form表单里的action值。这里主要介绍两种方法。
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>第一种方法</title><script language="javascript"> function check() { if (document.form1.a[0].checked == true)<!--表示选中页面一--> document.form1.action = "1.jsp" else document.form1.action = "2.jsp" }</script></head><body> <form name="form1" method="post" action="first" onSubmit="check();"> 页面一<input type="radio" name="a"> 页面二<input type="radio" name="a"> <input name="" type="submit" value="提交"> </form></body></html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>第二种方法</title></head><body> <form id="form1" name="form1" method="post" action="../news/index.asp"> <table width="100%" height="43" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="28"><input name="keyword" type="text" style="width: 150px" id="keyword" /></td> </tr> <tr> <td height="28"> <select name="Searchtype" style="width: 110px" id="Searchtype" onchange="Searchtype1();"> <option value="news" selected="selected">新闻中心</option> <option value="case">工程案例</option> </select> <input type="submit" name="Submit" value="搜索" /> </td> </tr> </table> </form> <script language="javascript"> function Searchtype1(){ <!--注意以下使用方法--> var type=document.getElementById("Searchtype").options[document.getElementById("Searchtype").selectedIndex].value; if (type=="news"){ document.getElementById("form1").action="../news/index.asp" } else if (type=="case"){ document.getElementById("form1").action="../case/index.asp" } } </script></body></html>
0 0
- 用JS动态改变表单form里的action值属性的方法
- JS动态改变form表单里的action值属性的方法
- 如何动态改变form表单的action
- 动态改变form表单中action的值
- js 提交form表单时,action的动态修改方法
- 动态设置form表单的action属性的值的方法
- 动态设置form表单的action属性的值的方法
- js 动态写form里的action
- jQueue 动态设置form表单的action属性的值和方法
- 如何动态的提交表单(即改变form的action)
- js改变form的action
- 动态改变表单的action.
- js 判断 form表单里的值
- js拿到单选按钮的值,以及js动态设置form表单的action值
- jsp表单中form标签的action属性的值
- 动态改变表单form的路径
- js修改form表单的action属性,commit提交后,再更改action属性。发现表单没有提交
- form表单的action
- 【记录】ldr
- java设计模式之工厂模式
- Oracle 不等于判断,防止字段内容为NULL时报错的情况
- 【NOIP模拟】Angel Beats!
- 工厂方法模式
- JS动态改变form表单里的action值属性的方法
- iOS 地图截屏
- 【记录】MOV与LDR
- 源码解析之–YYAsyncLayer异步绘制
- CNN
- Android事件分发与焦点争夺
- Hadoop版本变化
- 浅析树状数组
- Ubuntu14.04安装rabbitVCS_SVN