1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script type="text/javascript" src="JQScripts/jquery-1.4.3.min.js"></script>
<title>Nouvelle page 1</title>
<style type="text/css">
table {width:100%;
border-collapse:collapse;}
td {border: solid 1px grey:
}
</style>
<script type="text/javascript">
(function($) {
$.fn.ColorTableRows = function(params) {
var defaut={"evenColor":'#FFFCD2',"oddColor": '#FFF778', "hoverColor":'#FFA64F'};
var opts= $.extend(defaut,params)
$('<style type="text/css"> .hover{ background-color:'+opts.hoverColor+';}</style>').appendTo($("head")[0]);
$(this).find('tr:even').css({'background-color':opts.evenColor});
$(this).find('tr:odd').css({'background-color':opts.oddColor});
$(this).find('tr').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');})
};
})(jQuery);
$(function(){
$("#foo").ColorTableRows()
})
</script>
</head>
<body>
<table id="foo">
<tr>
</td> h</td>
</tr>
<tr>
</td> </td>
</tr>
<tr>
</td> </td>
</tr>
<tr>
</td> </td>
</tr>
<tr>
</td> </td>
</tr>
<tr>
</td> </td>
</tr>
<tr>
</td> </td>
</tr>
</table>
</body>
</html> |
Partager