// javascript document function createxhr() { if (typeof xmlhttprequest != 'undefined') { return new xmlhttprequest(); } else if (typeof activexobject != 'undefined') { var version = [ 'msxml2.xmlhttp.6.0', 'msxml2.xmlhttp.3.0', 'msxml2.xmlhttp' ]; for (var i = 0; version.length; i ++) { try { return new activexobject(version[i]); } catch (e) { } } } else { throw new error('您的系统或浏览器不支持xhr对象!'); } } function paramsjoin(data) { var arr = []; for (var i in data) { arr.push(encodeuricomponent(i) + '=' + encodeuricomponent(data[i])); } return arr.join('&'); } function ajax(obj) { var xhr = createxhr(); obj.url = obj.url + '/rand/' + math.random(); obj.data = paramsjoin(obj.data); if (obj.method === 'get') obj.url += obj.url.indexof('?') == -1 ? '/' + obj.data : '/' + obj.data; if (obj.async === true) { xhr.onreadystatechange = function () { if (xhr.readystate == 4) { callback(); } }; } xhr.open(obj.method, obj.url, obj.async); if (obj.method === 'post') { xhr.setrequestheader('content-type', 'application/x-www-form-urlencoded'); xhr.send(obj.data); } else { xhr.send(null); } if (obj.async === false) { callback(); } function callback() { if (xhr.status == 200) { obj.success(xhr.responsetext); } else { alert('获取数据错误!错误代号:' + xhr.status + ',错误信息:' + xhr.statustext,'error'); } } } //创建遮罩层 function cmask(){ var w = $(window).width(); var h = $(window).height(); $("body").append('
'); } //隐藏遮罩层 function hide(){ $("#vmask").hide().remove(); } //滚动及左右切换 function switch_div(wraper,prev,next,img,speed,or){ var wraper = $(wraper); var prev = $(prev); var next = $(next); var img = $(img).find('ul'); var w = img.find('li').outerwidth(true); var s = speed; next.click(function(){ img.animate({'margin-left':-w},function(){ img.find('li').eq(0).appendto(img); img.css({'margin-left':0}); }); }); prev.click(function(){ img.find('li:last').prependto(img); img.css({'margin-left':-w}); img.animate({'margin-left':0}); }); if (or == true){ ad = setinterval(function() { next.click();},s*1000); wraper.hover(function(){clearinterval(ad);},function(){ad = setinterval(function() { next.click();},s*1000);}); } } $(document).ready(function(e) { $.post( think+'/index/visitstatistics', {},function(data){return true;},'json'); //访问统计信息 });