The evil IE6 does not support the max-height attribute, but we can use jQuery to solve the problem that IE6 does not support the max-height attribute. The jQuery code is as follows:
$ (". Entry"). each (function (){
If ($ (this) [0]. scrollHeight> 500)
Watermark (this).css ({"height": "500px "});
});
Principle: in IE6, you can set the height to achieve the max-height effect. loop all the DOM elements that need to add the max-height attribute to determine that their scrollHeight is greater than the maximum height you want to set. If the maximum height is exceeded, set the height to the maximum height, I am using [0] Here. The obtained DOM object is not the jQuery object. For details, see: jQuery selector usage details.
The above Code has not been judged by IE6. The complete code is as follows:
If ($. browser. msie & amp; ($. browser. version === "6.0 ")){
$ (". Entry"). each (function (){
If ($ (this) [0]. scrollHeight> 500)
Watermark (this).css ({"height": "500px", "overflow": "hidden "});
});}
Of course, you can also use css expressions to implement IE6 support the max-height attribute.
. Entry {
// Test woshao_985140e4b71711df9e5e000c295b2b8d
Height: expression (this. scrollHeight & gt; 500? "500px": "auto");/* sets max-height
Original article: http://www.js8.in/606.html