We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

xalexx on 01/26/08


Tagged

width ie layout


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

inamorix
SpinZ
snucko
micmath


Min-width & max-width for IE


Published in: JavaScript 


  1. window.attachEvent('onload', mkwidth);
  2. window.attachEvent('onresize', mkwidth);
  3.  
  4. var minwidth = document.getElementById("site").currentStyle['min-width'].replace('px', '');
  5. var maxwidth = document.getElementById("site").currentStyle['max-width'].replace('px', '');
  6.  
  7. function mkwidth(){
  8. document.getElementById("site").style.width = document.documentElement.clientWidth < minwidth ? minwidth+"px" : (document.documentElement.clientWidth > maxwidth ? maxwidth+"px" : "100%");
  9. };

Report this snippet 

You need to login to post a comment.