Se connecter avec
S'enregistrer | Connectez-vous

créer une barre de défilement dans un tableau

Dernière réponse : dans Programmation
Lassé par la pub ? Créez un compte

  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>one</title>
  6. <style type='text/css'>
  7. td.headcol {width:auto;}
  8.  
  9. </style>
  10. </head>
  11.  
  12. <body>
  13. <div style="width:100%;overflow:auto;">
  14. <table border="1" style="width:100%;overflow:hidden;">
  15. <tr colspan=5>
  16. <td class='headcol' id='col1'>one</td>
  17. <td class='headcol' id='col2'>two</td>
  18. <td class='headcol' id='col3'>three</td>
  19. <td class='headcol' id='col4'>four</td>
  20. <td style="width:10px;"></td>
  21. </tr>
  22. </table>
  23. <div>
  24. <div style="width:100%;height:200px;overflow-Y:auto;">
  25. <table border="1" style="width:100%;overflow:hidden">
  26. <script type='text/javascript'>
  27. var largcol = new Array()
  28. for (i=1;i<5;i++){
  29. largcol[i]=parseInt(document.getElementById('col'+i).offsetWidth)-3 + "px";
  30. }
  31. for (i=0;i<55;i++){
  32. document.write("\<tr\>\<td style='width:"+largcol[1]+"'\>dsfqsdfsdd dsqf qsdf sdqf sqdf qsdf sdf  \<\/td\>\<td style='width:"+largcol[2]+"'\>two\<\/td\>\<td style='width:"+largcol[3]+"'\>three\<\/td\>\<td style='width:"+largcol[4]+"'\>four\<\/td\>\<\/tr\>")
  33. }
  34. </script>
  35. </table>
  36. <div>
  37.  
  38. </body>
  39.  
  40. </html>
Lassé par la pub ? Créez un compte