This problem occurs when helping a friend get a website.
Solution:
Reference: Use CSS to scale the image (this is similar to an endless loop when IE6 is run. The difference is that auto is used and this. width is used)
CSS code compatible with IE and Firefox scaling by Image Width
The specific method is:
IMG {
Max-Width : 500px ;
Height : Auto ;
Width : Expression (this. width> 500? "500px": This. width) ;
}
Firefox uses max-width to limit the maximum width. Because IE does not know Max-width, expression is used to control the width.
Attached JS solution:
Reference: auto scaling of images in ASP (recommended)
The above JSCodeNo.
JS implementation is relatively simple, but difficult to write. CSS is convenient, concise, and flexible.
Appendix: When solving this problem, I thought about getting the image size first and then determining it based on the size.
There are some ways to get the size on the Internet (ASP code): use ASP to get the image size (using ADODB. Stream)