The code for resetting the picture size in the news was pasted out, and IE8 passed the test.

Source: Internet
Author: User

CodeAs follows:

What I do is to control the proportion under a certain width, which is applicable to the general situation. For special control, you can just think differently.

<Script language = "JavaScript" type = "text/JavaScript">
// Reset the image size
VaR imgc = Document. getelementbyid ("imgc ");
VaR limitwidth = 570;
VaR imgarr = imgc. getelementsbytagname ("IMG ");
For (VAR I = 0; I {
VaR imgobj = imgarr [I];
Imgobj. onload = function ()
{
If (this. width)
{
VaR orazw = This. width;
VaR orazh = This. height;
If (orazw> limitwidth)
{
// This. rel = "lightbox ";
This. width = limitwidth;
This. Height = (this. Width * orazh)/orazw;
This. Title = "click to view the large image ";
This. style. cursor = 'hand ';
This. onclick = function () {var Mw = showbigimg ("imgshow. aspx", this. SRC, window. Screen. availWidth-100, window. Screen. availHeight-100 );}
}
}
}
}
</SCRIPT>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.