锘縱ar browser; var _topHeight = 0; var _scrollTop = 0; $(function () { browser = { versions: function () { var u = navigator.userAgent, app = navigator.appVersion; return {//绉诲姩缁堢娴忚鍣ㄧ増鏈俊鎭 trident: u.indexOf('Trident') > -1, //IE鍐呮牳 presto: u.indexOf('Presto') > -1, //opera鍐呮牳 webKit: u.indexOf('AppleWebKit') > -1, //鑻规灉銆佽胺姝屽唴鏍 gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //鐏嫄鍐呮牳 mobile: !!u.match(/AppleWebKit.*Mobile.*/), //鏄惁涓虹Щ鍔ㄧ粓绔 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios缁堢 android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android缁堢鎴杣c娴忚鍣 iPhone: u.indexOf('iPhone') > -1, //鏄惁涓篿Phone鎴栬€匭QHD娴忚鍣 iPad: u.indexOf('iPad') > -1, //鏄惁iPad webApp: u.indexOf('Safari') == -1 //鏄惁web搴旇绋嬪簭锛屾病鏈夊ご閮ㄤ笌搴曢儴 }; } (), language: (navigator.browserLanguage || navigator.language).toLowerCase() } // // // _topHeight = $("div.da20").height(); // if (top_nav == 0) { // $("div.nav-wrap").css({ "top": _topHeight + "px" }); // $("div.m-top-wrap").css({ "top": _topHeight + "px" }); // } // $(window).resize(function () { //褰撴祻瑙堝櫒澶у皬鍙樺寲鏃 // _topHeight = $("div.da20").height(); // _scrollTop = $(window).scrollTop(); // if (top_nav == 0) { // if (_scrollTop > _topHeight) { // $("div.nav-wrap").css({ "top": "0px" }); // $("div.m-top-wrap").css({ "top": "0px" }); // } else if (_scrollTop > 0 && _scrollTop <= _topHeight) { // var htop = _topHeight - _scrollTop; // $("div.nav-wrap").css({ "top": htop + "px" }); // $("div.m-top-wrap").css({ "top": htop + "px" }); // } else { // $("div.nav-wrap").css({ "top": _topHeight + "px" }); // $("div.m-top-wrap").css({ "top": _topHeight + "px" }); // } // } // }); $(window).scroll(function () { _scrollTop = $(window).scrollTop(); // if (top_nav == 0) { // var htop = _topHeight - _scrollTop; // if (htop <= 0) { // $("div.nav-wrap").addClass("nav-wrap-activate"); // $("div.nav-wrap").css({ "top": "0px" }); // $("div.m-top-wrap").addClass("m-top-wrap-activate"); // $("div.m-top-wrap").css({ "top": "0px" }); // } else { // $("div.nav-wrap").removeClass("nav-wrap-activate"); // $("div.nav-wrap").css({ "top": htop + "px" }); // $("div.m-top-wrap").removeClass("m-top-wrap-activate"); // $("div.m-top-wrap").css({ "top": htop + "px" }); // } // } else { if (_scrollTop >= 1) { $("div.nav-wrap").addClass("nav-wrap-activate"); $("div.m-top-wrap").addClass("m-top-wrap-activate"); } else { $("div.nav-wrap").removeClass("nav-wrap-activate"); $("div.m-top-wrap").removeClass("m-top-wrap-activate"); } //} }) //椤堕儴鑿滃崟 $("#menu" + top_nav).eq(0).addClass("activate"); $("#top-" + left_nav).addClass("activate"); $(".top-" + left_nav).addClass("activate"); $("#bottomenu" + top_nav).find("a").eq(0).addClass("hover"); $("#menu ul li").hover(function () { var size = $(this).find("div.box-wrap dl dt").length; var _h = 30 * size + 30; $(this).addClass("activate"); //$(this).find("div.bg").css({ "height": _h + "px" }); $(this).find("div.bg").stop(true, true).slideDown(400); $(this).find("div.box-wrap").stop(true, true).slideDown(400); }, function () { $(this).removeClass("activate"); //$(this).find("div.bg").css({ "height": "0px" }); $(this).find("div.bg").stop(true, true).slideUp(200); $(this).find("div.box-wrap").stop(true, true).slideUp(200); $("#menu" + top_nav).eq(0).addClass("activate"); }); //鎵嬫満鐗堝鑸 $("div.btn-menu").click(function () { $(this).hide(); $("div.btn-close-menu").show(); $("div.m-top-wrap").css({ "background-color": "#0062ac" }); $("div.mob-nav").show(100); }); //鎵嬫満鐗堝鑸叧闂 $("div.btn-close-menu").click(function () { $(this).hide(); $("div.btn-menu").show(); $("div.m-top-wrap").css({ "background": "" }); $("div.mob-nav").hide(100); }); $("div.nav li").click(function () { $("div.nav dl").hide(); $(this).parent().next("dl").slideToggle("slow"); }); $(document).keyup(function (event) { if (event.keyCode == 13) { SearchNewsM(); } }); $("#btnAllSearchM").click(function () { SearchNewsM(); }); }); function SearchNewsM() { var keyword = $("#txtTitleConM").val(); if (keyword == null || keyword == "" || keyword.length < 2 || keyword.length > 30 || keyword == "璇疯緭鍏ユ悳绱㈠叧閿瓧") { layer.msg("璇疯緭鍏ユ悳绱㈠叧閿瓧"); return false; } else { checkText("txtTitleConM", keyword); } //window.open('Search.aspx?SearchText=' + escape($("#txtTitleConM").val()) + ''); } function checkText(id, text) {//xss鏀诲嚮鐗规畩瀛楃杩囨护 var arr = new Array(); arr = ["alert", "eval", "", "onblur", "onload", "onfocus", "onerror", "onclick", "onMouseOver", "onMouseOut", "onSelect", "onChange", "onSubmit", "console", "href", "", "", "", "", "", "", "", "", "", "", "document", "location", "javascript"]; $.each(arr, function (index, value) { if (text.indexOf(value) != -1) { layer.msg("杈撳叆淇℃伅鍖呭惈" + value + "鐗规畩瀛楃"); $('#' + id).val(""); $('#' + id).focus(); return false; } window.location.href = "Search.aspx?SearchText=" + escape(text) + ""; }); }