function(jsUrl,cb,async){ var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; var script = document.createElement( "script" ); if( async !== false ){ //异步 script.async = "async"; script.defer = "defer"; } script.src = jsUrl; if(cb){ try{ script.onload = script.onreadystatechange = function( _eve, isAbort ) { if(isAbort || !script.readyState || /loaded|complete/.test( script.readyState )){ // 清除ie状态否则ie版本不同会执行对此回调方法 script.onload = script.onreadystatechange = null; script = undefined; if(!isAbort){//!isAbort = (success ok 200) cb(); } } }; }catch(e){} } head.insertBefore( script, head.firstChild ); }
?
var frame = document.getElementById('app_comment_dlg_iframe'); frame.onload = frame.onreadystatechange = function(_eve, isAbort) { if (isAbort || !frame.readyState || /loaded|complete/.test(frame.readyState)) { frame.onload = frame.onreadystatechange = null; frame = undefined; if (!isAbort) { Comment.loadJs(CONST_COMMENT.BSFW_URL + "/skins/js/messenger.js", function() { var _iframe = document.getElementById('app_comment_dlg_iframe'); var messenger = Messenger.initInParent(_iframe); messenger.onmessage = function(data) { var res = eval('(' + data + ')'); if (res.res_data) { if (res.is_close) { Comment.closeCommentDlg(); alert(res.cause); } else { alert(res.cause); } } else { _iframe.style.height = data + 'px'; divContain.style.height = data + 'px'; } }; }); } } };
?