2013-04-11 41 views
0

我想在使用javascript提交表單時發送值。由於一些編程限制,我不能使用函數。所以我可以像這樣在一個參數中給出兩個值?在參數中使用兩個值提交表單

<form name="editDelete" ...> 
<input type="hidden" name="theParam"/> 
... 

<a href="#" ... onclick="document.editDelete.theParam.value = 'the value'; document.editDelete.submit();">Test</a> 

或者是有什麼辦法提交表單發送的<a href>標籤本身使用單個命令的值?

回答

1

試試這個最終解決方案;

<form id="editDelete" ...> 
<input type="hidden" id="theParam" name="theParam"/> 

<a href="#" onclick="document.getElementById('theParam').value = 'thee value'; document.getElementById('editDelete').submit();">Test</a> 
+0

不工作.... – user1144004 2013-04-11 13:11:08

+0

嘗試編輯的解決方案。 – 2013-04-11 13:17:06

+0

表單在兩種情況下均未提交 – user1144004 2013-04-11 13:20:46

0

你可以在表單中使用GET方法嗎? here is an example

<A HREF="../form.html?value1=West&value2=East>2 values</A> 
+0

我必須使用POST方法 – user1144004 2013-04-11 13:13:30