可以是這樣做的
HTML
<form action="./hi_friend.php" method="post" id="countForm">
<select name="selList" id="selList">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Last</option>
</select>
<input type="submit" value="submit">
</form>
JS
$('#countForm').submit(function(){
var $form = $("#countForm");
if($("#selList").val() == "1")
$form.action = "./first_result.php";
else if($("#selList").val() == "2")
$form.action = "./second_result.php";
else if($("#selList").val() == "3")
$form.action = "./last_result.php";
alert("submit to " + $form.action);
return true;
});
Working fiddle
對不起,我對此很感興趣。我會在哪裏放這個代碼? – kmoore1004
@ kmoore1004您需要[jQuery](https://developers.google.com/speed/libraries/#jquery)。複製1.x片段代碼並粘貼到「head」之間。並複製(和編輯)我的答案的js代碼,粘貼到''之間。 – Mystika