<%--
    Document   : test
    Created on : 2011-2-25, 14:20:37
    Author     : MK
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>


   <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>js</title>
</head>
<script language="javascript">
function aa(){
    var r=document.getElementsByName("r");
    for(var i=0;i<r.length;i++){
         if(r[i].checked){
         alert(r[i].value+","+r[i].nextSibling.nodeValue);
       }
    }
}

function de_j(){
   var tab =document.getElementById("table的id");

tab.deleteRow(要删除的行的索引);//当然table中的行索引是从0开始的

    for(var i=0;i<r.length;i++){
         if(r[i].checked){
             r.
          r.deleteRow(要删除的行的索引);//当然table中的行索引是从0开始的
       }
    }
}
</script>


<body>
<form name="form1" method="post" action="">
<input type="checkbox" name="r" value="1">a<br>
<input type="checkbox" name="r" value="2">b<br>
<input type="checkbox" name="r" value="3">c<br>
<input type="checkbox" name="r" value="4">d<br>
<input type="checkbox" name="r" value="5">e<br>
<input type="checkbox" name="r" value="6">f<br>
<input type="checkbox" name="r" value="7">g<br>
<input type="checkbox" name="r" value="8">h<br>
<input type="checkbox" name="r" value="9">i<br>
<input type="checkbox" name="r" value="10">j<br>
<input type="checkbox" id="11" value="10">j<br>
<br>
<input type="button" onclick="aa()" value="button">
<input type="button" onclick="de_j()" value="delete">
</form>
</body>
</html>

    <%--

<script>
function selall()
{
 var a=document.getElementById("c1");
 var b=document.getElementById("sel");
 var obj=a.getElementsByTagName("input")
 if( b.innerHTML=="全选")
 { for( var i=0;i<obj.length;i++)
   if (obj[i].type=="checkbox") obj[i].checked=true;
  b.innerHTML="清空"
 }
 else
 { for( var i=0;i<obj.length;i++)
   if (obj[i].type=="checkbox") obj[i].checked=false;
  b.innerHTML="全选"
 }
}

</script>
<span id='sel' style='cursor:pointer' onclick='selall()'>全选</span>

<script language="javascript">
            window.onload=function showtable(){
            var tablename=document.getElementById("123");  <%--这个是表格的名称
            var li=tablename.getElementsByTagName("tr");
            for (var i=0;i<=li.length;i++){
                li[i].style.backgroundColor="#e5f1f4";
                li[i].onmouseover=function(){
                this.style.backgroundColor="#92c2de";
                }
                li[i].onmouseout=function(){
                this.style.backgroundColor="#e5f1f4"
                }
              }
          }
      </script>  --%>




</html>

<%--
document.write("<span id='sel' style='cursor:pointer' onclick='selall()'>全选</span>")

document.write("<div id=\"c1\"><table border=1>")
for(var i = 0;i<5;i++)
{
 document.write("<tr>");
 for(var j = 0;j<10 ;j++)
 {
  document.write("<td>")
  document.write("<input type=\"checkbox\" >");
  document.write("</td>")
 }
 document.write("</tr>");
}
document.write("</table></div>")

--%>
posted on 2011-02-28 18:14  hotty  阅读(591)  评论(0)    收藏  举报