[英]Get form name using javascript
How to get the form name when peress a button inside the form ? 如何在表格中按下按钮时获取表单名称? document.forms[0].name
will do the job only if i have one form. document.forms[0].name
只有在我有一个表单时才能完成这项工作。 How about for multiple forms ? 多种形式怎么样?
FORM: 形成:
<form name="aaa">
<input type="button" name="submit" value="Submit Form" onclick="somefunction();">
</form>
FUNCTION: 功能:
<script>
function somefunction()
{
var thename=document.forms[0].name;
alert (thename);
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.