Javascript的onclick在td标签内
javascript onclick inside td tag
我想提交一个包含<table>
的<form>
。如何提交具有默认动作的<form>
?与<select>
标签,我可以提交一个表单与onchange
javascript函数。我认为<td>
标签内的onclick="this.form.submit"
会解决,但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>
this
对象,您在onclick函数中引用的是单击的td
,而不是整个文档。你可能想用这个代替:
onclick="document.forms[0].submit()"
相关文章:
- 查找所有TD标签并读取其数据属性
- 如何在动态生成的 HTML 表中使用 2D 数组在 TD 标签中设置值
- 选中和取消选中不同的 td 标签
- <的Onchange事件;td>标签
- 如何从 td 标签中获取值并在 php 中另一个页面的文本框中显示此值
- jQuery .click 函数在 < td > 标签上不起作用
- 如何在TR的最后一个TD中添加事件或将ID属性添加到IMG标签
- 使用 jQuery 更改内部特定 Div 标签内的 TD 值
- 删除TD标签中的点击
- 使用 jQuery 访问 TD 内部的 Div 标签
- 选择所有按钮以选择td标签
- 获取TD标签的特定值
- 使用TD标签中的数据创建阵列
- jQuery添加文本之间的href标签的td
- 动态更改TD标签的id's不是永久性的
- 使用javascript为td标签添加css类
- 填充p和td html标签
- 从"td"字符串中提取字符标签
- 如何应用css样式的动态tr与td和输入标签
- CSS在标签最后的TR TD