Home>
method 1:
<form 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" /></td>
</tr>
<tr>
<td height="28"><select name="searchtype" onchange="searchtype1 ();">
<option value="news" selected="selected">News</option>
<option value="case">Engineering Case</option>
</select>
<input type="submit" name="submit" value="search" /></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>
Method 2:
<html>
<head>
<script language="javascript">
function check () {
if (document.form1.a [0] .checked == true)
document.form1.action="1.htm"
else
document.form1.action="2.htm"
}
</script>
</head>
<body>
<form name="form1" method="post" action="" onsubmit="check ();">
Go to page one<input type="radio" name="a">
Go to page two<input type="radio" name="a">
<input name="" type="submit" value="submit">
</form>
</body>
</html>
Related articles
- Implementation method of dynamically creating form and submitting in JavaScript
- Implementation method of js dynamically generating form and submitting in ajax mode
- Js method for dynamically adding node content to form
- Method for creating dynamic form in javascript
- Example of a method for dynamically adding Form elements in JavaScript
Trends