Home > Web Front-end > JS Tutorial > body text

Problem with JS dynamically setting image src address under IE6_javascript skills

WBOY
Release: 2016-05-16 18:36:52
Original
957 people have browsed it

I have been working on a project for the past two days, which required the mouse to click on the small picture to display the large picture, so I used JS to set the SRC of the large picture based on the small picture. After the design was completed, the problem came out. The large image cannot be displayed under IE6. The link address can be displayed normally when the mouse is placed on the image and right-clicked. Only by clicking Show Image can the image be displayed normally. IE7, IE8 and FF do not have these problems. The code is as follows:

Copy code The code is as follows:

function picclick()
{
var pic = $('marqueediv').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: here Add "return false;"
return false;
}
}
(i)
}
}

According to the Internet, this It is due to a problem with the underlying judgment discontinuity factor under IE6.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!