var count = 3; var isclick = false; var currentmenuName = "Properties"; $(function () { $("#btnSearchFloat").click(function () { location.href = "/ProductList.aspx?kwd=" + $("#keyWordFloat").val(); }); var anchor = $("a[data-field='anchor']"); var coordinate = $("a[data-field='coordinate']"); //var shtml = "
"; //for (var i = 0; i < anchor.length; i++) { // //href="#' + $(anchor[i]).attr("data-upper") + '" // if (i==0) { // shtml += '' + $(anchor[i]).attr("data-upper") + ''; // } // else { // shtml += '' + $(anchor[i]).attr("data-upper") + ''; // } //} //shtml += "
"; //$("#menufloat").html(shtml); //$("#menufloat2").html(shtml); $("#menufloat a").click(function () { $(document).scrollTop($("#" + $(this).attr("data-upper")).offset().top - 80); isclick = true; currentmenuName = $(this).attr("data-upper"); }) $("#menufloat2 a").click(function () { $(document).scrollTop($("#" + $(this).attr("data-upper")).offset().top - 80); isclick = true; currentmenuName = $(this).attr("data-upper"); }) $("#holder a").click(function () { var offsetTop = $("a[name='" + $(this).html().replace(" 试剂级价格", "试剂级价格") + "']").offset().top - 55 $(document).scrollTop(offsetTop); return false; }) $("#kw").keydown(function (event) { if (event.keyCode == 13) { location.href = "/ProductList.aspx?kwd=" + $(this).val(); } }); $("#keyWordFloat").keydown(function (event) { if (event.keyCode == 13) { location.href = "/ProductList.aspx?kwd=" + $(this).val(); } }); $("#Structure").click(function () { location.href = "/StructuredSearch.htm"; }) $(window).scroll(function () { if (isclick) { $("#menufloat2 a").removeClass("current"); $("#menufloat2 a[data-upper='" + currentmenuName + "']").addClass("current"); $("#menufloat a").removeClass("current"); $("#menufloat a[data-upper='" + currentmenuName + "']").addClass("current"); } else { for (var i = 0; i < coordinate.length; i++) { if ($(coordinate[i]).offset().top - $(this).scrollTop() > 0 && ($(coordinate[i]).offset().top - $(this).scrollTop() < 500) && ($(coordinate[i]).offset().top - $(this).scrollTop() > -100)) { $("#menufloat2 a").removeClass("current"); $("#menufloat2 a[data-upper='" + $(coordinate[i]).attr("data-upper") + "']").addClass("current"); $("#menufloat a").removeClass("current"); $("#menufloat a[data-upper='" + $(coordinate[i]).attr("data-upper") + "']").addClass("current"); } } var scrollTop = $(this).scrollTop(); if (scrollTop > $("#menufloat").offset().top) { $("#menufloat2").show(); $("#menufloat").css("visibility", "hidden"); } else if (scrollTop <= $("#menufloat").offset().top) { $("#menufloat2").hide(); $("#menufloat").css("visibility", ""); } } if (isclick && currentmenuName != 'Properties') { var scrollTop = $(this).scrollTop(); if (scrollTop > $("#menufloat").offset().top) { $("#menufloat2").show(); $("#menufloat").css("visibility", "hidden"); } else if (scrollTop <= $("#menufloat").offset().top) { $("#menufloat2").hide(); $("#menufloat").css("visibility", ""); } } isclick = false; }); $("#menufloat a").click(function () { isclick = true; currentmenuName = $(this).attr("data-upper"); $("#menufloat a").removeClass("current"); $(this).addClass("current"); $("#menufloat2 a").removeClass("current"); $("#menufloat2 a[data-upper='" + $(this).text() + "']").addClass("current"); }); $("#menufloat2 a").click(function () { isclick = true; currentmenuName = $(this).attr("data-upper"); $("#menufloat2 a").removeClass("current"); $(this).addClass("current"); $("#menufloat a").removeClass("current"); $("#menufloat a[data-upper='" + $(this).text() + "']").addClass("current"); }); $("div[data-field='goldpro']").click(function () { location.href = "/ProductAdvertising.aspx"; }); //$("#SupplierCountDetail").change(function () { // $.get("/Handler/GetSupplieListByNationality.ashx", { cbn: $("#cbnumber").val(), country: $("#SupplierCountDetail").val() }, function (result) { // var type = result.Type; // var suppliers = result.Suppliers; // if (suppliers != null) { // var shtml = "Supplier TelFaxEmail Country ProdListAdvantage "; // for (var i = 0; i < suppliers.length > 0; i++) { // shtml += ""; // var IsVip = false; // if (suppliers[i].HWOrderValue >= 206) { // IsVip = true; // } // if (type = "A") { // if (IsVip) { // if (suppliers[i].HWOrderValue >= 280 && suppliers[i].HWOrderValue <= 300) { // shtml += "
" + suppliers[i].SupplierEName + "
"; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // else if (suppliers[i].HWOrderValue >= 310) { // shtml += "
" + suppliers[i].SupplierEName + ""; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // else { // shtml += "
" + suppliers[i].SupplierEName + ""; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // } // else { // if (suppliers[i].HWOrderValue >= 280 && suppliers[i].HWOrderValue <= 300) { // shtml += "" + suppliers[i].SupplierEName + "
"; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // else if (suppliers[i].HWOrderValue >= 310) { // shtml += "" + suppliers[i].SupplierEName + ""; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // else { // shtml += "" + suppliers[i].SupplierEName + ""; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // } // } // else { // shtml += "" + suppliers[i].SupplierEName + ""; // if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) { // shtml += ""; // } // shtml += ""; // } // shtml += " " + suppliers[i].Tel + "
"; // shtml += "" + suppliers[i].Fax + ""; // shtml += "" + suppliers[i].Email + ""; // shtml += " " + suppliers[i].SNationality + ""; // shtml += "" + suppliers[i].ProdCount + " "; // shtml += " " + suppliers[i].ECEI + ""; // } // $("#GridView2").empty(); // $("#GridView2").html(shtml); // $("div[data-field='goldpro']").unbind("click"); // $("div[data-field='goldpro']").click(function () { // location.href = "/ProductAdvertising.aspx"; // }); // } // }, "json"); //}); $("#prev_main").click(function () { if (count <= 3) { return; } $("li[data-id='" + count + "']").hide(); $("li[data-id='" + (count - 3) + "']").show(); count--; }) $("#next_main").click(function () { if (count >= $("#imagetext_productcount").val()) { return; } count++; $("li[data-id='" + count + "']").show(); $("li[data-id='" + (count - 3) + "']").hide(); }) $("#bt_delegate_list").click(function () { var cas = $(this).attr("data-cas"); var productname = $(this).attr("data-productname"); var cbnumber = $(this).attr("data-cbnumber"); source = "ChemicalProductProperty_EN_new.aspx"; location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source; }); $("#bt_delegate_list_float").click(function () { var cas = $(this).attr("data-cas"); var productname = $(this).attr("data-productname"); var cbnumber = $(this).attr("data-cbnumber"); source = "ChemicalProductProperty_EN_new.aspx"; location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source; }); $("input[data-field='inquiry']").click(function () { delCookie("merge"); setCookie("merge", $(this).attr("data-cbsid"), "d1"); var cas = $("#bt_delegate_list").attr("data-cas"); var productname = $("#bt_delegate_list").attr("data-productname"); var cbnumber = $("#bt_delegate_list").attr("data-cbnumber"); source = "ChemicalProductProperty_EN_new.aspx"; location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source; }); $("#spectrumdiv a").attr('target', '_blank'); }) function delCookie(name) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval = getCookie(name); if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString(); } function setCookie(name, value, time) { var strsec = getsec(time); var exp = new Date(); exp.setTime(exp.getTime() + strsec * 1); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); } function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(arr[2]); else return null; } function getsec(str) { var str1 = str.substring(1, str.length) * 1; var str2 = str.substring(0, 1); if (str2 == "s") { return str1 * 1000; } else if (str2 == "h") { return str1 * 60 * 60 * 1000; } else if (str2 == "d") { return str1 * 24 * 60 * 60 * 1000; } }