如何给多个名称相同的 复选框 复值

mmclg 2003-10-21 11:30:40

如何给多个名称相同的 复选框 复值

复选框名称wpps[]

在VBS中,如果名称为wpps就可以复值,换成wpps[]后就不行,这是为什么

tp是一个框架名称

top.tp.form1.wpps.checked=1

...全文
47 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudchen 2003-10-21
  • 打赏
  • 举报
回复
document.forms[0].elements["wpps[]"]
mmclg 2003-10-21
  • 打赏
  • 举报
回复
名字是wpps[]不是wpps
利而不害 2003-10-21
  • 打赏
  • 举报
回复
wpps[]是数组的写法,怎么用来做名称了?
控件名称只能是英文字母和数字组成。

<input type="checkbox" name="wpps">
<input type="checkbox" name="wpps">
<input type="checkbox" name="wpps">
<input type="button" name="" value="第一个打勾" onClick="wpps[0].checked=true">
xuzuning 2003-10-21
  • 打赏
  • 举报
回复
for(i=0;i<top.tp.form1["wpps[]"].length;i++)
top.tp.form1["wpps[]"][i].checked=1
topmonkey 2003-10-21
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//CN">
<HTML>
<HEAD>
<TITLE> Q2378358 </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Generator" CONTENT="Microsoft Notepad">
<META NAME="Author" CONTENT="吴雷">
<META NAME="Keywords" CONTENT="http://expert.csdn.net/Expert/topic/2378/2378358.xml">
<META NAME="Description" CONTENT="Re: Q2378358">
</HEAD>

<BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
<center>VBScript</center>
1<Input Type="checkbox" Name="a" Value="1"><br>
2<Input Type="checkbox" Name="a" Value="2"><br>
3<Input Type="checkbox" Name="a" Value="3"><br>
4<Input Type="checkbox" Name="a" Value="4"><br>
5<Input Type="checkbox" Name="a" Value="5"><br>
6<Input Type="checkbox" Name="a" Value="6"><br>
<Input Type="button" NAME="but" Value="选1、3" onClick="aaa()">
<Input Type="button" NAME="but" Value="全选" onClick="bbb()">
<Input Type="button" NAME="but" Value="反选" onClick="ccc()">
<Script Language="VBScript">
Function aaa()
a(0).Checked = True
a(2).Checked = True
End Function

Function bbb()
For Each i In a
i.Checked = True
Next
End Function

Function ccc()
For Each i In a
If i.Checked Then
i.Checked = False
Else
i.Checked = True
End If
Next
End Function
</Script>
</BODY>
</HTML>
梦想成真2003 2003-10-21
  • 打赏
  • 举报
回复
名字不能加[]

top.tp.form1.wpps[0].checked=1
利而不害 2003-10-21
  • 打赏
  • 举报
回复
to mmclg(毛毛虫)
你这个名字是wpps[]的控件是非法命名,不可以这样命名的。
就像文件名也不能随便乱取一样的道理!

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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