【发布时间】:2011-09-02 10:09:56
【问题描述】:
我为这个问题简化了我的代码,但在我的最终 web 应用程序中,一个页面上有大约 100 个表单,而不是这里的两个。我的问题是让我的链接使用 javascript 提交表单的最佳方法是什么。我现在所拥有的显然不起作用,因为有多个名为 supporttype 的字段。对于大约 100 个表格的大规模执行我想做的事情的最佳方法是什么。
<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>
【问题讨论】:
标签: javascript forms post hyperlink