js问题,谢谢!!!

snolidge 2003-05-07 05:14:34
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function Update(includes,text,enable)
{
var i;

for (i=0; i<document.newfilter.includes.length; i++) {
if (document.newfilter.includes.options[i].value==includes) {
document.newfilter.includes.options[i].selected=true;
break;
}
}

document.newfilter.text.value = text;

if (enable == 1)
document.newfilter.enable.checked = true;
else
document.newfilter.enable.checked = false;
}
//-->
</script>
</head>

<BODY>
<TABLE border=0 cellspacing=1 align=center cellpadding=3 class=tableline width=95%>
<TR bgcolor="#E4E4E4" align="center">
<td nowrap align="center" > <b>1/2</b></td>
<td nowrap align="center" > <b>text(按一下修改)</b></td>
<td nowrap align="center" > <b>ok</b></td>
<td nowrap align="center" > <b>option</b></td>
</tr>
<form name="newfilter" method="post" action="test.php">
<input type="hidden" name="action" value="add" />
<TR align="center">
<td nowrap align=center bgcolor="#f6f6f5">
<select name="includes">
<option selected value="1">1</option>
<option value="2">2</option>
</select>
</td>
<td nowrap align=center bgcolor="#f6f6f5">
<input type="text" name="text" size="26" accesskey="I" />
</td>
<td nowrap align=center bgcolor="#f6f6f5">
<input type="checkbox" name="enable" value="1" checked />
</td>
<td nowrap align="center" bgcolor="#f6f6f5" >
<input type="submit" name="submit" value="增加/修改" />
</td>
</tr>
</form>
<TR bgcolor=#f6f6f5 align=center>
<td >2</td>
<td ><a href="Javascript:Update('2','nihao','')">
nihao</a></td>
<td ></td>
<td >
----
</td>
</tr>
</table>
</body>
</html>

上面的js能实现数据传递,我想问的是当点击“nihao”后怎样才能让 <input type="hidden" name="action" value="add" />中的value值变为modify,按钮就可以实现修改功能
js我不会,上边的是抄别人的。
value
...全文
48 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
snolidge 2003-05-07
  • 打赏
  • 举报
回复
原来这么简单,呵呵
给分
xuzuning 2003-05-07
  • 打赏
  • 举报
回复
function Update(includes,text,enable) {
.....

document.newfilter.action.value = "modify"
}
snolidge 2003-05-07
  • 打赏
  • 举报
回复
初始状态按钮是添加的,当用户选择要修改的项时,提交后action的值不是add而是modify

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧