像下面这样通过javascript添加href是一种不好的做法吗?在 IE8 中,即使页面已更新,我也看到状态栏不断加载,我怀疑下面的代码会导致这种情况发生。
document.getElementById('sucessMsgId').innerHTML = 'Your profile has been updated. <a href='+xProfileUri+'>View Profile</a>';
正确的方法是什么?使用jQuery修复上述代码是否可以解决IE状态栏加载问题?
更新:发现IE浏览器状态加载不断,因为它进入这部分jQUery代码并没有完成执行。当我将加载事件附加到 iframe 并且仅在 IE8 中时,会发生这种情况。
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}