一個好看的表格CSS樣式

============================================================================

原創作品,允許轉載。轉載時請務必以超鏈接形式標明原始出處、以及本聲明。

請註明轉自:http://yunjianfei.iteye.com/blog/

 

============================================================================

 

直接上主題,首先是運行效果:


具體的代碼如下:

 

 

文件名:test.css

table.t1 {
        margin-top:10px;
        margin-left:20px;
        margin-right:20px;
        margin-bottom:5px;
        #background-color: #FFF;
        #background:#EEF4F9;
        #border: none;
        border: 1;
        #color:#003755;
        border-collapse:collapse;
        font: 14px  "宋體";
}

table.t1 th{
        background:#7CB8E2;
        color:#fff;
        padding:6px 4px;
        text-align:center;
}

table.t1 td{
        background:#C7DDEE none repeat-x scroll center left;
        color:#000;
        padding:4px 2px;
}

table.t1 a{
        text-decoration:none;
        height:1em;
}

table.t1 a:link, table.t1  a:visited{
        color:#3366CC;
}
table.t1  a:hover{                                      /* 鼠標經過時 */
        color:#B50000;
        text-decoration:underline;
}

 

測試文件名:test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<link rel="stylesheet" type="text/css" href="./test.css"/>
<script>
	   function test() {
	    var a = confirm("是否刪除?");
		if(a)
		  
	     alert("刪除成功!");
		 else alert("操作失敗!");
	   }
	 </script>
	 <script>
  function selectall() {
    var a = document.all;
	for(var i = 0;i<a.length;i++) {
	   if(typeof a[i]!="undefind" && a[i].type=='checkbox') {
	      a[i].checked=true;
	   }
	}
  }

  function unselectall() {
    var a = document.all;
	for(var i = 0;i<a.length;i++) {
	  if(typeof a[i]!="undefind" && a[i].type=='checkbox') {
	    a[i].checked=false;
	  }
	}
  }

</script>
</head>
  
  <body>
  <hr>
  <center> 
  <form action="" name="form1">
  
   <table border="1"  class="t1">
     <tr><th>編號</th><th>姓名</th><th>性別</th><th>電話號碼</th><th>郵箱</th><th>刪除</th><th>修改</th></tr>
     <tr>
      <td>123</td><td>王五</td><td>男</td><td>123456</td><td>123</td><td><input type="checkbox" ></td><td><a href="updataEmp.html">修改</a></td></tr>
      <td>123</td><td>王五</td><td>男</td><td>123456</td><td>123</td><td><input type="checkbox" ></td><td><a href="updataEmp.html">修改</a></td></tr>
	  <td>123</td><td>王五</td><td>男</td><td>123456</td><td>123</td><td><input type="checkbox" ></td><td><a href="updataEmp.html">修改</a></td></tr>
   </table>
    <input type="button" name="" value="全選" onClick="selectall()">
   <input type="button" name="" value="反選" onClick="unselectall()">
   <input type="button" name = "shanchu"value="刪除" onClick="test()">
   </form>
   </center>
  </body>
</html>

 

 

發佈了19 篇原創文章 · 獲贊 16 · 訪問量 8332
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章