【发布时间】:2013-10-08 03:46:13
【问题描述】:
提交表单时我有一个表单,我将调用一个 javascript 函数并将其操作到表单处理程序。
<form action="subscribe.php" onsubmit="return form_check(this)" method="post">
<input type="text" value="">
<input type="submit" value="click">
</form>
一切正常,现在我想将相同的表单字段发送到另一个 javascript 函数,所以我在提交代码上尝试了这样的操作
<form action="subscribe.php"
onsubmit="return (form_check(this) & another_script(this))" method="post">
在 onsubmit 中添加了 &,但单击按钮时该功能未触发。我认为这是由于表格中的action="subscribe.php"。
我还想将表单值发送到另一个 javascript 函数。我怎样才能做到这一点?
【问题讨论】:
-
用分号分隔它们,而不是和号。如果两个函数都返回不同的东西,我不确定它会如何工作。
-
你想返回哪个函数的值?
form_check或another_script? -
为什么
another_script不在form_check函数内? -
@Mike Christensen 谢谢我想同时执行这两个函数。这可能吗?
-
这可能不是问题,但我认为您可能会混淆bitwise & operator with the logical && operator。
标签: javascript jquery html