This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#mark").animate({marginTop:marginTop "px"},200,function(){ | |
$("#mark").animate({marginTop:marginTop-20 "px"},100,function(){ | |
$("#mark").animate({marginTop:marginTop "px"},100); | |
}); | |
});}else{ | |
$("#mark").animate({marginTop:marginTop "px"},200,function(){ | |
$("#mark").animate({marginTop:marginTop 20 "px"},100,function(){ | |
$("#mark").animate({marginTop:marginTop "px"},100); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取光标相对于整个页面的当前位置(兼容各浏览器) | |
//获取光标的水平位置 | |
function getX(e){ | |
e = e || window.event; | |
//先检查非IE浏览器,在检查IE的位置 | |
return e.pageX || e.clentX + document.body.scrollLeft; | |
} | |
//获取光标的垂直位置 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getStyle(elem, name){ | |
//如果属性存在于style[]中,直接取 | |
if(elem.style[name]){ | |
return elem.style[name]; | |
} | |
//否则 尝试IE的方法 | |
else if(elem.currentStyle){ | |
return elem.currentStyle[name]; | |
} | |
//尝试W3C的方式 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div onclick="test('hello')">Click me!</div> | |
<script type="text/javascript" language="javascript"> | |
function test(arg,arg2) { | |
var _e=window.event||arguments.callee.caller.arguments[0]; | |
alert("arguments.callee:\n"+arguments.callee+"\n"); | |
alert("arguments.callee.arguments[0]:\n"+arguments.callee.arguments[0]+"\n"); | |
alert("arguments.callee.caller:\n"+arguments.callee.caller+"\n"); | |
alert("arguments.callee.caller.arguments[0]:\n"+arguments.callee.caller.arguments[0]+"\n"); | |
alert("_e:\n"+_e+"\n"); | |
alert("_e.type:\n"+_e.type+"\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.Format = function (fmt) { //author: meizz | |
var o = { | |
"M+": this.getMonth() + 1, //月份 | |
"d+": this.getDate(), //日 | |
"h+": this.getHours(), //小时 | |
"m+": this.getMinutes(), //分 | |
"s+": this.getSeconds(), //秒 | |
"q+": Math.floor((this.getMonth() + 3) / 3), //季度 | |
"S": this.getMilliseconds() //毫秒 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Event handler for mouse wheel event. | |
*鼠标滚动事件 | |
*/ | |
var wheel = function(event) { | |
var delta = 0; | |
if (!event) /* For IE. */ | |
event = window.event; | |
if (event.wheelDelta) { /* IE/Opera. */ | |
delta = event.wheelDelta / 120; | |
} else if (event.detail) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
.outer { | |
display: table; | |
width: 500px; | |
height: 300px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.Center-Container { | |
position: relative; | |
} | |
.Absolute-Center { | |
width: 50%; | |
height: 50%; | |
overflow: auto; | |
margin: auto; | |
position: absolute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//浅克隆 | |
/*Object.prototype.clone = function (){ | |
var obj = {}; | |
for(var key in this) { | |
if(this.hasOwnProperty(key)) { | |
obj[key] = this[key]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxSetup({ scriptCharset: "gbk" , contentType: "application/json; charset=gbk"}); |