Home >Web Front-end >JS Tutorial >The solution to the problem that js changes the src attribute of the img tag but does not respond in IE_javascript skills

The solution to the problem that js changes the src attribute of the img tag but does not respond in IE_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:28:171198browse

When I was writing a project today, I encountered an image that needed to be changed dynamically, for example:
The solution to the problem that js changes the src attribute of the img tag but does not respond in IE_javascript skills

Then when changing, use a js script:
document.getElementById('checkCodeImage').src='images /image02.jpg';

Then it can be changed successfully in Chrome FF, but not in IE. After searching online for a long time, I roughly understand that this is a bug of IE. If you want to change the src attribute Successfully, you can write like this:
document.getElementById('checkCodeImage').src='images/image02.jpg' Date();

Then, and then, and then it succeeds. Speechless, small question, remember one,

Statement:
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