方法1:
<form id = "form1" name = "form1" method = "post" action = "../ news/index.asp"> <table cellpadding = "0" cellspacing = "0"> <tr> <td> <td> <input name = "keyword" type = "text" id = "keyword"/>> </td> </tr <td <td> <td> <"search td> <" search td> onChange = "searchType1();"> <option値= "selected =" selected ">新闻中心</option> <option value =" case ">工程案例</option> </select> <input type =" in name = "" submit "" value = " 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"}} </scrip>方法2:
<html> <head> <スクリプト言語= "javascript"> function check(){if(document.form1.a [0] .checked == true)document.form1.action = "1.htm" elsedocument.form1.action = "2.htm"} </script> </head> <body> <form = "post" "post" onsubmit = "check();">转到页面一<入力タイプ= "radio" name "a">转到页面二<input type = "radio" name = "a"> <input name = "" type = "" value = "提交"> </form> </body> </html>以上这篇用js动态改变表单form里的アクション值属性的两种方法就是小编分享给大家的全部内容了、希望能给大家一个参考、也希望大家多多支持武林网。