If this parameter is not added, it seems that only ie6 has encountered problems. See: changed the image address, the image disappears, the style is loaded, but the style file is gone. Just like the download of A resource is interrupted. The correct explanation is that when you use element A in IE6 as A button, remember to call preventDefault () in the onclick event (), IE6 will force the current active HTTP connection to close, leading to abnormal loading of other resources or scripts being requested. However, if the resource has been cached, this problem will not occur.
Copy codeThe Code is as follows:
<! Doctype html>
<Html>
<Head>
</Head>
<Body>
<H2> it will appear in ie6. If you click "src" to change the image, the image will not appear. preventDefault or return false is required. <A id = "J_btn" href = "javascript: void (0)"> click to change the image address </a>
<Script type = "text/javascript">
Var $ = function (id) {return typeof (id) = "string "? Document. getElementById (id): null };
Var logo_bd = 'HTTP: // www.bkjia.com/uploads/allianz 131017/013sb114-0.gif ';
Var logo_go = 'HTTP: // www.google.com.hk/intl/zh-CN/images/logo_cn.png'
$ ("J_btn"). onclick = function (event ){
Event = event | window. event;
// Event. preventDefault? Event. preventDefault (): event. returnValue = false;
$ ("J_img"). src = $ ("J_img"). src = logo_bd? Logo_go: logo_bd;
}
</Script>
</Body>
</Html>