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 69 70 71 72 73 74 75 76
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>...</title>
<style type="text/css">
#tab1 td {
text-align:center;
width:40px;
height:30px;
background-color:#ff0000;
font-weight:bold
}
</style>
</head>
<body>
<p>
<strong>En cliquant sur une cellule quelconque, on efface la colonne.</strong>
<br />
Effectivement, le travail est long, que ce soit pour générer la page, d'ailleurs,
ou pour gérer toutes les cellules;<br />
(là, je n'ai que 1000 lignes)
</p>
<div id="cadre"></div>
<script type="text/javascript">
function efface(col){
var tt=document.getElementById("tab1").getElementsByTagName("td");
for(i=0;i<tt.length;i++){
if(tt[i].getAttribute(col)){
tt[i].style.display='none'
}
}
}
var tab=["zero","un","deux","trois","quatre","cinq","six","sept","huit","neuf"];
var t=document.createElement("table");
t.setAttribute("id","tab1");
var tb=document.createElement("tbody");
t.appendChild(tb);
for(i=0;i<1000;i++){
l=document.createElement("tr");
for(j=0;j<10;j++){
c=document.createElement("td");
c.attr=tab[j];
c.appendChild(document.createTextNode(tab[j]));
c.setAttribute(tab[j],tab[j]);
c.onclick=function(){
efface(this.attr)
}
l.appendChild(c);
};
tb.appendChild(l);
};
document.getElementById("cadre").appendChild(t);
</script>
</body>
</html> |
Partager