(function(win) { function ScriptLoader(){ this.timeout = 10000; }; ScriptLoader.prototype.loadScript = function(url, success, error){ var t = this, elm,_time; // Execute callback when script is loaded function done() { clearTimeout(_time); removeElm(); if(success){ success(); } }; function removeElm(){ if (elm){ elm.parentNode.removeChild(elm); elm.onreadystatechange = elm.onload = elm = null; } } function errorHandle() { clearTimeout(_time); // Report the error so it's easier for people to spot loading errors if (typeof(console) !== "undefined" && console.log){ console.log("Failed to load: " + url); } removeElm(); if(error){ error(); } }; function createElm(url){ var elm = document.createElement('script'); elm.src = url; if (elm.readyState) { //IE, ie9 onload 触发在js解析和执行之前 elm.onreadystatechange = function(){ if (elm.readyState == "loaded" || elm.readyState == "complete") { elm.onreadystatechange = null; done(); } }; } else { //Others elm.onload = done; elm.onerror = errorHandle; } return elm; }; // Create new script element elm = createElm(url); (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); _time =setTimeout(function(){ errorHandle(); },t.timeout); }; ScriptLoader.prototype.load = function(urls,success,error){ if(typeof urls ==='string'){ this.loadScript(urls,success,error); return; } if(urls instanceof Array){ var cnt = urls.length,flag = true; for(var i = 0,len=cnt;flag&&i '+info['area']+' '+info['content']+' '+info['penalty']+' '+info['deductScore']+' '; toolpenalty += parseInt(info['penalty']); toolscore += parseInt(info['deductScore']); mark = 1; } if (mark==0){ constr += ' 恭喜你,你目前没有任何违章记录! '; } if(toolpenalty || toolscore) { constr += '待缴费金额'+toolpenalty+'元,待处理积分'+toolscore+'分'; retry = 0; } $("#result").html(constr); retry = 0; $("#search").hide(); $("#results").show(); } else { // 尝试重试 retry = 1; if(retry) { $('#captchaimg').attr("src","http://8848.qingdaonews.com/wzcx/code.php?r="+Math.random()); alert(data['message']); } } // 记录cookie carnum = carnum.toUpperCase(); evin = evin.toUpperCase(); var temp = {'cph':carnum, 'cjh':evin}; var key = carnum+'_'+evin; list[key] = temp; var value = JSON.stringify(list); if($.cookie) { $.cookie('wzcx_list', value, {expires: 365, path: '/', domain: '.qingdaonews.com'}); } WZCX.initlist(); dis = 0; $(".op-weizhang-submit").html(" 结果查询 "); }, error: function (XMLHttpRequest, textStatus, errorThrown) { dis = 0; $(".op-weizhang-submit").html(" 结果查询 "); } }); }); $(".op-back").click(function(){ $("#search").show(); $("#results").hide(); WZCX.initlist(); $("#captcha").val(''); $("#captchaimg").click(); }); $("#cjh").focus(function(){ $("#wz-tip").show(); }); }; WZCX.initlist = function(){ $("#wzcx_list").html(''); if(!$.cookie) { list = {}; return list; } var list = $.cookie('wzcx_list'); if(list) { list = JSON.parse(list); var constr = ''; for(key in list) { var info = list[key]; constr += ''; } constr += '
车牌号码发动机/车架号
鲁'+info['cph']+'
'+info['cjh']+'查看违章详情
'; $("#wzcx_list").html(constr); $(".op-weizhang-cars-search").bind('click', function(){ $("#cph").val($(this).parent().parent().find('.op-weizhang-cph').html().replace('鲁', '')); $("#cjh").val($(this).parent().parent().find('.op-weizhang-cjh').html()); $('.op-weizhang-submit').click(); }); $(".op-weizhang-cars-remove").bind('click', function(){ var cph = $(this).parent().parent().find('.op-weizhang-cph').html().replace('鲁', ''); var cjh = $(this).parent().parent().find('.op-weizhang-cjh').html(); var key = cph+'_'+cjh; var list = $.cookie('wzcx_list'); if(list) { list = JSON.parse(list); delete list[key] isempty = true; for(i in list) { isempty = false; break; } if(isempty) { $.cookie('wzcx_list', '', {expires: -1, path: '/', domain: '.qingdaonews.com'}); } else { var value = JSON.stringify(list); $.cookie('wzcx_list', value, {expires: 365, path: '/', domain: '.qingdaonews.com'}); } WZCX.initlist(); } }); } else { list = {}; } return list; } win.WZCX = WZCX; WZCX.init(); })(window); document.write('');