我不會命名選擇。相反,給他們ID並做一個隱藏的表單字段,然後使用JavaScript來更新隱藏字段。
function updateHiddenField(){
var year = document.getElementById("YearDD").value; //this is conceptual
var make = document.getElementById("MakeDD").value; //this is conceptual
var model = document.getElementById("ModelDD").value; //this is conceptual
document.getElementById("s").value = year+"+"+make+"+"+model; //this is conceptual
}
再後來......
<input type="hidden" name="s" id="s" value="">
<select id="YearDD" onChange="updateHiddenField();">
...
否則你可能會覆蓋「提交」按鈕,生成自己的查詢字符串/ URL和重定向的頁面。
或者,在一個真正的骯髒的方式,你可以搜索字符串和「+」轉換「& s =」。
謝謝,我試圖實現該代碼時遇到了麻煩。老實說,我花了太多的時間在這個項目上,因爲......你能指引我到我需要編輯的頁面去做「骯髒的方式嗎?」 – user1279475 2012-03-19 21:07:50
http://tinkerbin.com/MVNZ4pMP 這是瘋狂的骯髒,但它的作品。 – FrankieTheKneeMan 2012-03-19 21:25:43
@ user1279475爲您工作嗎? – FrankieTheKneeMan 2012-03-19 22:12:50