客户端加JS代码判断复选框是否全选的代码

 客户端代码:

<body id=main>
    <form id="form1" runat="server">
    <DIV class=m2 id=topmusic3 style="MARGIN-LEFT: 170px;">
        <DIV class=h>
        <H4>华人乐队组合</H4></DIV>
        <UL>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3773.html">凤凰传奇</A></SPAN><INPUT id=id
          type=checkbox value=270240><A href="http://www.ssjj.com/play/270240.html"
          target=ssjj_play>自由飞翔</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3773.html">凤凰传奇</A></SPAN><INPUT id=Checkbox1
          type=checkbox value=270245><A href="http://www.ssjj.com/play/270245.html"
          target=ssjj_play>等爱的玫瑰</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/8752.html">袁成杰/戚薇</A></SPAN><INPUT id=Checkbox2
          type=checkbox value=284380><A href="http://www.ssjj.com/play/284380.html"
          target=ssjj_play>外滩十八号</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/1731.html">办桌二人组</A></SPAN><INPUT id=Checkbox3
          type=checkbox value=290261><A href="http://www.ssjj.com/play/290261.html"
          target=ssjj_play>在心里从此永远有个你</A></LI>
          <LI><SPAN><A href="http://www.ssjj.com/special/4281.html">TRY</A></SPAN><INPUT
          id=Checkbox4 type=checkbox value=258841><A
          href="http://www.ssjj.com/play/258841.html"
          target=ssjj_play>不要在我寂寞的时候说爱我</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3729.html">AiMiNi</A></SPAN><INPUT id=Checkbox5
          type=checkbox value=111136><A href="http://www.ssjj.com/play/111136.html"
          target=ssjj_play>遇</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/8734.html">BOBO</A></SPAN><INPUT id=Checkbox6
          type=checkbox value=283811><A href="http://www.ssjj.com/play/283811.html"
          target=ssjj_play>光荣</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3822.html">海雷的好朋友们</A></SPAN><INPUT id=Checkbox7
          type=checkbox value=116130><A href="http://www.ssjj.com/play/116130.html"
          target=ssjj_play>玫瑰花的葬礼 - 许嵩</A></LI>
          <LI><SPAN><A href="http://www.ssjj.com/special/2159.html">信乐团</A></SPAN><INPUT
          id=Checkbox8 type=checkbox value=86234><A href="http://www.ssjj.com/play/86234.html"
          target=ssjj_play>假如</A></LI>
          <LI><SPAN><A href="http://www.ssjj.com/special/330.html">动力火车</A></SPAN><INPUT
          id=Checkbox9 type=checkbox value=8777><A href="http://www.ssjj.com/play/8777.html"
          target=ssjj_play>第一滴泪</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3773.html">凤凰传奇</A></SPAN><INPUT id=Checkbox10
          type=checkbox value=114284><A href="http://www.ssjj.com/play/114284.html"
          target=ssjj_play>我和草原有个约会</A></LI>
          <LI><SPAN><A href="http://www.ssjj.com/special/1857.html">Beyond(比安
          黄家驹)</A></SPAN><INPUT id=Checkbox11 type=checkbox value=6373><A
          href="http://www.ssjj.com/play/6373.html" target=ssjj_play>光辉岁月</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/3476.html">黑涩会美眉</A></SPAN><INPUT id=Checkbox12
          type=checkbox value=258025><A href="http://www.ssjj.com/play/258025.html"
          target=ssjj_play>123木头人</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/1630.html">Sweety</A></SPAN><INPUT id=Checkbox13
          type=checkbox value=92799><A href="http://www.ssjj.com/play/92799.html"
          target=ssjj_play>樱花草</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/7872.html">雨天&杨蔓</A></SPAN><INPUT id=Checkbox14
          type=checkbox value=283262><A href="http://www.ssjj.com/play/283262.html"
          target=ssjj_play>今生最爱</A></LI>
          <LI><SPAN><A
          href="http://www.ssjj.com/special/1795.html">南拳妈妈</A></SPAN><INPUT id=Checkbox15
          type=checkbox value=292314><A href="http://www.ssjj.com/play/292314.html"
          target=ssjj_play>再见 小时候</A></LI>
          <LI><SPAN><A href="http://www.ssjj.com/special/687.html">梦飞船</A></SPAN><INPUT
          id=Checkbox16 type=checkbox value=111914><A
          href="http://www.ssjj.com/play/111914.html" target=ssjj_play>不值得</A></LI></UL>
        <DIV class=h2>
            <INPUT class=buon onMouseOver="this.className='buonz'" onClick="clk('all','topmusic3');" onMouseOut="this.className='buon'" type=button value=全选 />
            <INPUT class=buon onMouseOver="this.className='buonz'" onClick="clk('reverse','topmusic3');" onMouseOut="this.className='buon'" type=button value=反选 />
            <INPUT class=buon1 onMouseOver="this.className='buonz1'" onClick="clk('play','main');" onMouseOut="this.className='buon1'" type=button value=连续播放 />
        </DIV>
    </DIV>
    </form>
</body>

 

 

JS方法:

function getTags(parentobj, tag)
{
 if (parentobj == null)
 {
  return new Array();
 }
 else if (typeof parentobj.getElementsByTagName != 'undefined')
 {
  return parentobj.getElementsByTagName(tag);
 }
 else if (parentobj.all && parentobj.all.tags)
 {
  return parentobj.all.tags(tag);
 }
 else
 {
  return new Array();
 }
}

 

function clk(type,id)
{
 var url = "";
 var object2;
 var object = getTags(getObject(id),"input");
 for(var i=0;i<object.length;i++)
 {
  object2 = object[i];
  if(type=="all")
  {
   object2.checked = true;
  }
  else if(type=="reverse")
  {
   if(object2.checked)
   {
    object2.checked = false;
   }
   else
   {
    object2.checked = true;
   }
  }
  else
  {
   if(object[i].value>0 && object[i].checked)
   {
    url = url + object[i].value + "/";
   }
  }
 }
 if(type=="play")
 {
  url = url.substring(0,url.length-1);
  if(url.length==0)
  {
   alert("请选择歌曲!");
  }
  else
  {   
   window.open("MusicPlayer.aspx");
  }
 }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值