JS Dynamic Setting of image src address in IE6 _ javascript skills

Source: Internet
Author: User
Solve the problem that the image cannot be loaded incorrectly when JS dynamically sets the image SRC of IMG under IE6. In the past two days, a project will be created, and you need to click the thumbnail to display the large image, therefore, JS is used to set the SRC of the big Image Based on the small image. After the design, the problem arises. In IE6, the large image cannot be displayed. You can right-click the image to display the link address. IE7, IE8, and FF have no such problems. The Code is as follows:

The Code is as follows:


Function picclick ()
{
Var pic = $ ('marqueep '). getElementsByTagName ('A ');
Var len = pic. length;
For (var I = 0; I <len; I ++)
{
Pic [I]. onclick = function (I)
{
Return function ()
{
For (var t = 0; t <len; t ++)
{
Pic [t]. className = t = I? 'Hover ':'';
This. className = 'hover'
}
Var thispic;
Sspic = pic [I]. childNodes [0]. src;
Thispic = 'uploadimg/'+ sspic. substring (sspic. indexOf ('uploadimg/s'), sspic. length). replace ('uploadimg/s ','');
$ ('Pro _ pic_item '). setAttribute ('src', thispic );
$ ('Pro _ pic_item '). setAttribute ('alt', 'images ');
// Solution: Add "return false;" here ;"
Return false;
}
}
(I)
}
}


According to Internet knowledge, this is a problem of the underlying judgment factors of ie6.
Related Article

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.