This file contains hidden or 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
jquery mobile的a标签点击无法跳转的问题 | |
需要在a标签加上data-ajax="false" |
This file contains hidden or 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
http://www.cnblogs.com/mofish/p/3388427.html | |
js判断数组类型的方法 | |
方法一之 instanceof | |
instance,故名思义,实例,例子,所以instanceof 用于判断一个变量是否某个对象的实例,是一个三目运算式---和typeof最实质上的区别 | |
a instanceof b?alert("true"):alert("false") //注意b值是你想要判断的那种数据类型,不是一个字符串,比如Array |
This file contains hidden or 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
js数组元素的添加和删除一直比较迷惑,今天终于找到详细说明的资料了,先给个我测试的代码^-^ | |
var arr = new Array(); | |
arr[0] = "aaa"; | |
arr[1] = "bbb"; | |
arr[2] = "ccc"; | |
//alert(arr.length);//3 | |
arr.pop(); | |
//alert(arr.length);//2 | |
//alert(arr[arr.length-1]);//bbb | |
arr.pop(); |
This file contains hidden or 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
所有浏览器都不支持box-flex,需要添加私有前缀 | |
均分 | |
-moz-box-flex:1.0; /* Firefox */ | |
-webkit-box-flex:1.0; /* Safari and Chrome */ | |
定义两个可伸缩的 p 元素。如果父元素的总宽度是 300 像素,则 #p1 的宽度是 100 像素,而 #p2 的宽度是 200 像素: | |
#p1 | |
{ | |
-moz-box-flex:1.0; /* Firefox */ |
This file contains hidden or 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
Javascript 正常取来源网页的URL只要用: | |
document.referrer | |
就可以了! | |
但,如果来源页是Javascript跳转过来的,上边的方法就拿不到了!所以用: | |
opener.location.href | |
所以,就有了下边的代码: |
This file contains hidden or 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
console.warn(‘aaaaaa'); | |
在输出信息前面会有一个带感叹号的黄色三角警告符号。似乎比一般的console信息要友好得多了。虽然图标是黄色的,但输出的文字仍然是黑色 | |
console.error(“adfafasdf”) | |
信息前面会出现一个带叉的红色圆形图标。 | |
这个效果要比警告信息更友好了,字体颜色成红色了。 | |
This file contains hidden or 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
JavaScript 数组转字符串,字符串转数组 | |
一、数组转字符串(将数组元素用某个字符连接成字符串) | |
var a, b; | |
a = new Array(0,1,2,3,4); | |
b = a.join("-"); | |
二、字符串转数组(将字符串按某个字符切割成若干个字符串,并以数组形式返回) | |
var s = "abc,abcd,aaa"; | |
ss = s.split(",");// 在每个逗号(,)处进行分解。 | |
This file contains hidden or 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
substring(start,end) | |
start 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置。 | |
stop 可选。一个非负的整数,比要提取的子串的最后一个字符在 stringObject 中的位置多 1。如果省略该参数,那么返回的子串会一直到字 符串的结尾。 | |
说明 | |
substring 方法返回的子串包括 start 处的字符,但不包括 end 处的字符。 | |
如果 start 与 end 相等,那么该方法返回的就是一个空串(即长度为 0 的字符串)。 | |
如果 start 比 end 大,那么该方法在提取子串之前会先交换这两个参数。 | |
如果 start 或 end 为负数,那么它将被替换为 0。 | |
This file contains hidden or 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
jQuery.ajax({ | |
url: "/Handle/Do.aspx", | |
type: "post", | |
data: { id: '0' }, | |
dataType: "json", | |
success: function(msg) { | |
alert(msg); | |
}, | |
error: function(XMLHttpRequest, textStatus, errorThrown) { | |
alert(XMLHttpRequest.status); |
This file contains hidden or 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
var str = $(".buy").attr("href").match(/^http:\/\/([^\/]+)\//i)[0]; |
NewerOlder