// JavaScript Document
// JavaScript Document
/*document.onkeydown = function(){
if(window.event && window.event.keyCode == 123) {
event.keyCode=0;
event.returnValue=false;
}
if(window.event && window.event.keyCode == 13) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 8) {
window.event.returnValue=false;
}
}
document.oncontextmenu = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
//屏蔽键盘事件
document.onkeydown = function (){
var e = window.event || arguments[0];
//F12
if(e.keyCode == 123){
return false;
//Ctrl+Shift+I
}else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
return false;
//Shift+F10
}else if((e.shiftKey) && (e.keyCode == 121)){
return false;
//Ctrl+U
}else if((e.ctrlKey) && (e.keyCode == 85)){
setTimeout(function(){
},1);
return false;
}
};
//屏蔽鼠标右键
document.oncontextmenu = function (){
setTimeout(function(){
},1);
return false;
}*/
$('#gotop').click(function () {
$('html,body').animate({
scrollTop : '0px'
}, 600);
});
$(function(){
$(window).on('scroll', function(){
if($(window).scrollTop() > 120){
$('.a_body').addClass('fixed');
} else {
$('.a_body').removeClass('fixed');
}
});
$(".navBox li").mouseenter(function () {
$(this).addClass("active");
$(this).find(".subNavbox").stop(false, false).animate({ top: 50, opacity: "show" }, 300);
});
$(".navBox li").mouseleave(function () {
$(this).removeClass("active");
$(this).find(".subNavbox").stop(false, false).animate({ top: 70, opacity: "hide" }, 300);
});
//IE9 兼容placdholder属性
function placeholderSupport() {
return 'placeholder' in document.createElement('input');
}
if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder
$("[placeholder]").each(function(){
var _this = $(this);
// console.log($(this).height());
var inputHeight = parseInt(parseInt($(this).height()-2)-14)/2;
var inputHeight = parseInt(parseInt(parseInt($(this).height()-2)/2)-7)+'px';
_this.parent().css({"position": "relative"});
var left = _this.position().left+parseInt(_this.css("padding-left"))+parseInt(_this.css("margin-left"))+"px";
var top = parseInt(_this.css("padding-top"));//+parseInt(_this.css("margin-top"))+"px";
var top = parseInt(_this.css("padding-top"));//+parseInt(_this.css("margin-top"))+"px";
_this.after('' + _this.attr("placeholder") + '');
//_this.after('' + _this.attr("placeholder") + '');
if(_this.val() != ""){
_this.parent().find("span.placeholder").hide();
}
else{
_this.parent().find("span.placeholder").show();
}
}).on("focus", function(){
$(this).parent().find("span.placeholder").hide();
}).on("blur", function(){
var _this = $(this);
if(_this.val() != ""){
_this.parent().find("span.placeholder").hide();
}
else{
_this.parent().find("span.placeholder").show();
}
});
// 点击表示placeholder的标签相当于触发input
$("span.placeholder").on("click", function(){
$(this).hide();
$(this).siblings("[placeholder]").trigger("click");
$(this).siblings("[placeholder]").trigger("focus");
});
}
});