div height adjustment on pageload


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Untitled</title>
  5. <style type="text/css">
  6. body, tr,td{
  7. font-family: Arial, sans-serif;
  8. font-size:11px;
  9. }
  10. div#divafb{
  11. width:350px;
  12. overflow-y:auto;
  13. margin-right:8px;
  14. height:400px;
  15. height:expression((document.body.clientHeight-20)+"px");
  16. background-color:#ececec;
  17. border:1px solid black;
  18. }
  19. </style>
  20. <script language="javascript">
  21. onload=function(){
  22. if(document.getElementById("divafb")&&navigator.appName=="Netscape"
  23. ){
  24. window.onresize=tmp=function(){
  25. document.getElementById("divafb").style.height=(document.body.clientHeight-20)
  26. }
  27. tmp()
  28. }
  29. }
  30.  
  31. </script>
  32. </head>
  33.  
  34. <body>
  35. <div id="divafb">
  36. </div>
  37. </body>
  38. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.