browser compatibality issue for scrolling div
I am facing an issue with browser compatibility. my code works fine in mozilla, IE6 but not in IE7. The code is for genaerating a scroolable div in the page.
<html>
<style rel='stylesheet' type='text/css'>
#scrolldiv
{
overflow: auto; max-height: 200px;
height:expression(this.scrollHeight>199?"200px":"auto");
}
</style>
<div id="scrolldiv" name="scrolldiv">
<table align="center" border=0>
<tr><td> </td></tr>
<tr><td>
<table width="95开发者_如何学运维%" align="center" cellpadding="0" border="0">
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
<tr><td>testdata1</td></tr>
<tr><td>testdata2</td></tr>
<tr><td>testdata3</td></tr>
</table>
</td></tr>
</table>
</div>
</html>
Please advise
Thanks in advance.
maybe you've disabled JavaScript in your IE7. IEs css-expressions are evaluated as javascript, so in this case it won't work.
please also note that you should avoid css-expressions whenever possible.
try
#scrolldiv
{
height:auto !important;
overflow: auto; max-height: 200px;
_height:200px;
}
If that is all your markup, you are missing a doctype and are in 'quirks mode'. Add this as your first line: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Then let's see where things stand.
精彩评论