一:事件(Event)对象 在触发dom事件的时候都会产生一个event对象type 获取事件类型target 获取事件目标stopPropagation() 阻止事件冒泡preventDefault() 阻止事件默认行为 eg:二:string对象lenget 长度indexof() 位置ma.....
分类:
编程语言 时间:
2015-04-10 21:49:29
阅读次数:
157
var?s?=?"hello?world!";????????????
var?word?=?s.substring(s.indexOf("?")+1,s.length); 字符串既然不是对象,为什么它会有属性呢?只要引用了字符串s的属性,javascript就会将字符串值通...
分类:
编程语言 时间:
2015-04-03 22:35:36
阅读次数:
224
自从JavaAPI&RegExp用熟练了之后就变得越来越任性越来越懒了):public class Solution { public int strStr(String haystack, String needle) { return haystack.indexOf(ne...
分类:
其他好文 时间:
2015-04-03 13:04:15
阅读次数:
139
namespace index{ class Program { static void Main(string[] args) { while (true) { string s = "abcdefghijklmn"; int i = s.IndexOf("f"); // i是f在字符串s中的位置...
分类:
其他好文 时间:
2015-04-02 22:35:37
阅读次数:
119
function getClientHeight(){ //可见高 var clientHeight=document.body.clientHeight;//其它浏览器默认值 if(navigator.userAgent.indexOf("MSIE 6.0")!=-1) {...
分类:
Web程序 时间:
2015-04-01 16:53:10
阅读次数:
142
代码如下: var id = null; var name = null; if (window.location.search.indexOf("&") == -1){//如果不存在"&" id=window.location.search.substr...
分类:
Web程序 时间:
2015-03-31 12:36:27
阅读次数:
146
var a = [1, 2, 3], b = [101, 2, 1, 10];var c = a.concat(b.filter(function (item) { return a.indexOf(item) < 0;}));
分类:
编程语言 时间:
2015-03-30 18:40:09
阅读次数:
201
//获取网站虚拟目录名称function GetVirtualDirectoryName() { var pathname = location.pathname; var pos = pathname.indexOf('/'); return pathname.substr(0,...
分类:
其他好文 时间:
2015-03-30 13:10:14
阅读次数:
116
1.背景 ????在写js的时候经常有查询一个字符串数组中是否存在某个值的需求,可以用for in或者for i++或者直接arr.join(‘,‘).indexOf()三种方式。。最后一种代码最少因此用的最多,但是效率如何自己也没有把握...
分类:
编程语言 时间:
2015-03-22 00:34:43
阅读次数:
195