摘要: // var fm=document.getElementById('myForm'); //第一种方法获取// var fm=document.getElementsByTagName('form')[0]; //第二种方法获取// var fm=document.forms[0]; //HTML 阅读全文
posted @ 2017-09-12 18:30 耿鑫 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-09-11 16:30 耿鑫 阅读(215) 评论(0) 推荐(0) 编辑
摘要: <span id="pox"> <div id="box" class="red">测试Div</div></span> addEvent(window,'load',function(){ var box=document.getElementById('box'); //W3C的mouseove 阅读全文
posted @ 2017-09-08 17:48 耿鑫 阅读(101) 评论(0) 推荐(0) 编辑
摘要: //W3C自带的两个添加事件和删除事件1.覆盖问题,解决window.addEventListener('load',function(){ alert('Lee');},false) window.addEventListener('load',function(){ alert('Mr.Lee' 阅读全文
posted @ 2017-08-24 15:46 耿鑫 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 事件绑定及深入 多个window.onload一起执行 如何让执行两个window.onloadwindow.onload=function(){ alert('Lee');} if(typeof window.onload=='function'){ var saved=null; //保存上一个 阅读全文
posted @ 2017-08-23 18:34 耿鑫 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 事件冒泡和捕获window.onload=function(){ document.onclick=function(){ alert('document'); }; document.documentElement.onclick=function(){ alert('html'); } docu 阅读全文
posted @ 2017-08-23 15:31 耿鑫 阅读(90) 评论(0) 推荐(0) 编辑
摘要: ondblclick: 双击 onmousedown: 当用户按下了鼠标还未弹起时触发。 onmouseup: 当用户释放鼠标按钮时触发。 onmouseover: 当鼠标移到某个元素上方时触发。 onmouseout: 当鼠标移出某个元素上方时触发。 onmousemove: 当鼠标指针在元素上移 阅读全文
posted @ 2017-08-23 15:17 耿鑫 阅读(122) 评论(0) 推荐(0) 编辑
摘要: JavaScript有三种事件模型:内联模型、脚本模型和DOM2模型。 内联模型,onclick是事件处理函数<input type="button" value="按钮" onclick="alert('Lee');"><input type="button" value="按钮" onclick 阅读全文
posted @ 2017-08-23 10:29 耿鑫 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 动态脚本:当网站需求变大,脚本的需求也逐步变大。我们就不得不引入太多的JS脚本而降低了整站的性能,所以就出现了动态脚本 的概念,在适时的时候加载相应的脚本。 比如:我们想在需要检测浏览器的时候,再引入检测文件。 demo.jswindow.onload=function(){ var flag=tr 阅读全文
posted @ 2017-08-22 18:24 耿鑫 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 计算后的样式 行内、内联、链接样式都可以获取<link rel="stylesheet" type="text/css" href="basic.css"/>window.onload=function(){ var box=document.getElementById('box'); var s 阅读全文
posted @ 2017-08-22 17:54 耿鑫 阅读(315) 评论(0) 推荐(0) 编辑