我想在其中提交<form>
<table>
。如何使用默认操作提交<form>
?使用<select>
标记,我可以使用onchange
javascript函数提交表单。我认为onclick="this.form.submit"
标记内的<td>
会解决,但是firebug表示错误:TypeError: this.form is undefined
有什么问题?
<div class="report">
<form method="post" name="status_students">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="tdreport">Active</td>
<td class="tdreport">Unstable</td>
<td class="tdreport">Inactive</td>
</tr>
<tr>
<td class="active" name="students_actives" value="actives" onclick="this.form.submit()">
<?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['verde']);
} else {
echo count($this->usersStatusSiteCenter['verde']);
}
?>
</td>
<td class="unstable"><?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['amarelo']);
} else {
echo count($this->usersStatusSiteCenter['amarelo']);
}
?>
</td>
<td class="inactive"><?php
if ($this->siteCenterSelected == "All") {
echo count($this->usersStatus['vermelho']);
} else {
echo count($this->usersStatusSiteCenter['vermelho']);
}
?>
</td>
</tr>
</table>
</form>
</div>
答案 0 :(得分:1)
this
对象是单击的td
,而不是整个文档。您可能想要使用它:
onclick="document.forms[0].submit()"
但实际上,您应该更好地通过ID来引用表单。