1.弹出提示框:

function prompt(msg){
$("<div>" + msg + "</div>").css({
"width": "200px",
"padding": "15px",
"line-height": "1.5em",
"text-align": "center",
"background": "rgba(51,51,51,.8)",
"color": "#fff",
"border-radius": "5px",
"box-shadow": "1px 1px 5px rgba(204,204,204,.4)",
"position": "absolute",
"z-index": "10000",
"top": "0",
"left": "50%",
"margin-left": "-100px"
}).appendTo("body").animate(
{top: "35%"},"normal", "linear",function() {
$(this).delay(500).fadeOut(1000,function() {
$(this).remove()
})
})
}

  2.js 网址URL查询:

function urlQuery(url){
var search = location.search;
var obj = {};
if (search.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i ++) {
obj[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}
return obj;
}

  

  3.jquery高级版本(3.2测试不支持)不支持如下的写法

$().load(function(){

})

  报错:

Uncaught TypeError: a.indexOf is not a function

  高版本请使用:

$().on('load',function(){});替代

  

都很简单,示例就不写了。。。

05-11 15:56