0
我簡化了我的代碼,但在最終的web應用中,在頁面上有〜100個表單而不是這兩個表單。我的問題是什麼是使我的鏈接提交表單與JavaScript的最佳方式。我現在所做的並不是很明顯,因爲有多個名爲supporttype的字段。什麼是最好的方式來做我想要做的大規模的〜100表格。使用多個鏈接提交的Javascript表單
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function getsupport (selectedtype)
{
document.albumdl.supporttype.value = selectedtype ;
document.albumdl.submit() ;
}
-->
</script>
</head>
<body>
<form name="albumdl" method="post" action="processLinks.php">
<input type="hidden" name="supporttype" />
<a href="javascript:getsupport('form1')">Form1 </a>
</form>
<form name="albumdl" method="post" action="processLinks.php">
<input type="hidden" name="supporttype" />
<a href="javascript:getsupport('form2')">From2</a>
</form>
</body>
</html>
如果你發現自己寫黑客做這樣的post請求,這意味着服務器部分必須有一些設計問題。 – timdream
這實際上正是我所需要的,謝謝。 – Andrew