标题:再请教一个问题
只看楼主
appple
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2004-9-4
 问题点数:0 回复次数:2 
再请教一个问题

怎么写一段程序,点击一个checkbox而让其它的检查窗都 跟着点上或取销.

2004-09-09 19:11
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 

太简单了吧

<script language="JavaScript"> //初始化已选择要删除记录个数为0 var CheckedNum=0 //计算已选择要删除记录数,设置“删除所选记录”按钮的有效性 function CheckedOne(Obj) { if(Obj.checked) { CheckedNum++; if(document.all("Del").disabled==true) document.all("Del").disabled=false; } else { CheckedNum--; if(CheckedNum==0) {document.all("Del").disabled=true;} } } //全选/清空 function CheckedAll(value) { if("" + document.TrainLineList.DelSel.length=="undefined") document.TrainLineList.DelSel.checked=value; else{ for(var i=0;i<document.TrainLineList.DelSel.length;i++){ document.TrainLineList.DelSel[i].checked=value; } } document.all("Del").disabled=!value; if(value) CheckedNum=i; else CheckedNum=0; } </script>

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center">&nbsp;</td> </tr> <tr> <td align="center"><strong><font color="#FF9933">火 车 票 维 护</font></strong></td> </tr> <tr> <td align="center"><table width="580" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="501" height="20" align="left"><TABLE cellSpacing=1 cellPadding=0 width="424" border=0 ID="Table2"> <form name="Search" method="Post"> <tr> <td width="19%" height="24"> <select name="Key"> <option value="Key">关键字</option> <option value="TrainNo" selected>车次</option> <option value="StartPos">起始地</option> <option value="EndPos">目的地</option> <option value="SeatType">席别</option> </select> <script language="JavaScript"> </script> </td> <td width="27%" height="24"> <input type="text" name="KeyWord" size="15"> <script language="JavaScript"> </script> </td> <td width="20%" height="24"> <input type="checkbox" name="QueryType" value="like" checked>模糊查询 </td> <script language="JavaScript"> </script> <td width="34%" height="24"> <input type="submit" name="Submit" value="查 询"> <input type="reset" name="Reset" value="重 填"> <input type="hidden" name="Action" value="Search"> </td> </tr> </form> </table></td> <td width="57" align="right"><a href="TrainTicket.asp" class="brown">添加线路</a></td> <td width="22" align="right">&nbsp;</td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="580" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="lineHeight20px"> <form action="DelTrainLine.asp" method="Post" name="TrainLineList"> <tr align="center" bgcolor="#FFFFFF"> <td width="36">删除</td> <td width="66">车次</td> <td width="101">起止地点</td> <td width="63">席别</td> <td width="59">票价</td> <td width="61">数量</td> <td width="107">添加/修改日期</td> <td width="78">查看/修改</td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="1" onClick="JavaScript:CheckedOne(this)"></td> <td>T532</td> <td>天津站-北京</td> <td>硬座</td> <td>30</td> <td>0</td> <td>2002-12-26</td> <td><a href="TrainTicket.asp?TrainLineID=1" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="2" onClick="JavaScript:CheckedOne(this)"></td> <td>K253</td> <td>天津站-广州东</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-26</td> <td><a href="TrainTicket.asp?TrainLineID=2" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="3" onClick="JavaScript:CheckedOne(this)"></td> <td>K33</td> <td>天津站-上海</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-26</td> <td><a href="TrainTicket.asp?TrainLineID=3" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="4" onClick="JavaScript:CheckedOne(this)"></td> <td>2545</td> <td>天津站-武昌</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=4" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="5" onClick="JavaScript:CheckedOne(this)"></td> <td>1477</td> <td>天津站-镇江</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=5" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="6" onClick="JavaScript:CheckedOne(this)"></td> <td>2085</td> <td>天津站-郑州</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=6" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="7" onClick="JavaScript:CheckedOne(this)"></td> <td>4483</td> <td>天津站-太原</td> <td>硬座</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=7" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="8" onClick="JavaScript:CheckedOne(this)"></td> <td>4475</td> <td>天津站-临汾</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=8" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="9" onClick="JavaScript:CheckedOne(this)"></td> <td>K39</td> <td>天津站-齐齐哈尔</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=9" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="10" onClick="JavaScript:CheckedOne(this)"></td> <td>T11</td> <td>天津站-沈阳北</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=10" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="11" onClick="JavaScript:CheckedOne(this)"></td> <td>1547</td> <td>天津站-哈尔滨</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=11" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="12" onClick="JavaScript:CheckedOne(this)"></td> <td>K215</td> <td>天津站-图们</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=12" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="13" onClick="JavaScript:CheckedOne(this)"></td> <td>1521</td> <td>天津站-哈尔滨</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=13" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="14" onClick="JavaScript:CheckedOne(this)"></td> <td>2223</td> <td>天津站-吉林</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=14" class="brown">查看/修改</a></td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><input type="checkbox" name="DelSel" value="15" onClick="JavaScript:CheckedOne(this)"></td> <td>K27</td> <td>天津站-丹东</td> <td>硬卧</td> <td>0</td> <td>0</td> <td>2002-12-27</td> <td><a href="TrainTicket.asp?TrainLineID=15" class="brown">查看/修改</a></td> </tr> </form> </table> <table border="0" cellpadding="0" cellspacing="0" width="580"> <form name="form2" method="post"> <tr> <td width="35" height="30" align="center"> <input type="checkbox" name="SelAll" onClick="JavaScript:CheckedAll(this.checked)"> </td> <td width="294">全选 <input type="hidden" name="pa" value="1"> <input type="hidden" name="Action" value="Page"> <input name="Del" type="button" disabled id="Del" onClick="JavaScript:if(window.confirm('是否真的要删除所选记录!')) document.TrainLineList.submit();" value="删除所选记录"></td> <td width="133" align="center"> 共 <font color="red">2</font> 页 第 <font color="red">1</font> 页 </td> <td width="118" align="right"> <input name="page" type="submit" class="ButtonLink" value="下一页"> </td> </tr> </form> </table> </td> </tr> <tr> <td>&nbsp;</td> </tr> </form> </table>


天津网站建设 http://www./
2004-09-09 19:47
appple
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2004-9-4
得分:0 
谢谢grief老大,我想做一个网上输出的网站,以前没做过任何网站程序.以前还有很多问题向你请教.
2004-09-09 20:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-5161-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052236 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved