查css 鼠标划过显示
alert 是弹出提示框
给网页一个new DATE() 是不是可以得到时间?
数组的方法 length push pop unshift shift splice concat链接
splice(a,b,c,d) 索引a的位置开始删除b个元素,添加元素,c,d..
join(‘’) 方法设置分隔符并讲其转换为字符串
字符串 split() 可以将其转换为数组
window.prompt(a,b) a是提示,b是默认值
-
获取样式 和属性 obj.style[样式] 只能获取行内样式 obj.getCurrentStyle['width']; 只能用于ie getComputedStyle(obj,false)['width']; 可以用于所有浏览器 if(obj.getCurr...){var width = obj.getCurr....} else{var width = getCom....}
-
arguments 获取函数参数 arguments.length 获取传入方法的参数个数 或者 直接在声明函数时给予 形参
4个内置函数:parseInt,parseFloat,isNaN,eval 对象的属性:prototype 给一类对象添加方法和属性。 var bill = new employee(...); employee.prototype.salary = null; vill.salary = 2000;
-
offsetleft 元素距离左侧的位置
-
setInterval(function(),time) clearInterval(funtions) 停止functions定时器
-
var e = e || window.event; 获取鼠标或者键盘
-
clientX 获取鼠标位置
-
offsetleft 控件距离左侧距离
#2017年 03月 16日 星期四 09:11:22 CST
- onselect
- oncopy nocopy window.event.returnValue=false
- oncut onpaste no cut or onpaste
- oncontextmenu right key fobit list
- addEventListener('event',function) event needn't on
- removeEventListener('',fun..)
- confirm(); a tip for del in a.oclick
- location
- href
- hash
- host
- pathname
- history
- go(-1) -1 is back 1 is go window.history.go
#2017年 03月 17日 星期五 10:24:31 CST
- input.onfocus 获取焦点 input.onblur 失去焦点
#2017年 03月 20日 星期一 09:37:46 CST
- document.write('') write to html
写js的位置,1.onclick中内嵌。2.onclick调用js方法。3.js中获取点击事件。
- s1.innerHTML document.write() #String ##属性 lengh ##方法 indexOf(string,[int]) lastIndexOf() charAt(int) 同string[int] 一样 toLowerCase() 字符串转化为小写 toUpperCase() slice() 返回字符串片段 substring() 截取 字符串 substr() 截取从指定位置开始,指定长度 #Math .abs() .min() .max() .random() .round() .floor() .ceil() #Date new Date() 有参为参数时间。 无参为当前 ##get 对象 getDate() 月份中的天数 getDay() 星期几0-6 getHours() 0-23 getMinutes() 0-59 getSeconds() 0-59 getMonth() 0-11 getYear() 年份 getTime() 1970-1-1 到现在的毫秒 getFullYrear() == getYear()+1900 ##set 对象 setDate() 设置月份中天数 setHours() setMinutes() setSeconds() setTime() setMonth() 1-12 没写都是0开始 #定时器 setTimeout() setInterval() #event event = e|| window.event keyCode clientX clientY #window对象 ##方法 confirm(); alert() prompt(); print(); setTimeout(); setInterval(); open(); close(); ##属性 closed查看是否已经关闭 #location ##属性 href hash host pathname search ##方法 reload() assign(); replace(); #history history.back() history.forward() hsitory.go() #DOM ##属性 document.title ##获取元素方法: document.getElementById() document.getElementByTagName() document.getElementByName(); #document 对象 ##属性 getAttribute() setAttribute() ##内容 innerHTML innerText||textContent; ##元素创建 document.createElement(); document.createTextNode(); ##节点操作 appendChild(); insertBefore(); removeChild(); cloneNode(); replaceChild(); ##节点获取 parentNode children and childNodes firstChild and firstElementChild lastChild and lastElementChild nextSibling and nextElementSibling previousSibling and previousElementSibling #form document.forms可以访问 ##基础 method GET/POST action URL enctype 编码