DOM
文章平均质量分 59
难瘦不难过
立志要当前端大神的蠢货
展开
-
DOM基础
无标题文档/*DOM : Document Object Model 文档对象模型文档:html页面文档对象:页面中元素文档对象模型:定义 为了能够让程序(js)去操作页面中的元素DOM会把文档看作是一棵树,同时定义了很多方法来操作这棵数中的每一个元素(节点)DOM节点getElementByIdgetElementByTagName原创 2016-07-29 08:57:38 · 206 阅读 · 0 评论 -
元素的创建
无标题文档window.onload = function() { var oText = document.getElementById('text1'); var oBtn = document.getElementById('btn'); var oUl = document.getElementById('ul1'); oBtn.原创 2016-08-02 16:44:01 · 192 阅读 · 0 评论 -
relacChild
无标题文档window.onload = function() { var oDiv = document.getElementById('div1'); var oBtn = document.getElementById('btn'); var oP = document.getElementById('p1'); oBtn.oncl原创 2016-08-02 16:44:59 · 220 阅读 · 0 评论 -
操作元素属性的多种方式
无标题文档window.onload = function() { var oText = document.getElementById('text1'); /* . [] */ //oText.value = '222'; //alert( oText.value ); //oText['value'] = '2原创 2016-08-02 16:46:16 · 372 阅读 · 0 评论 -
表单的值
无标题文档window.onload = function() { var oForm = document.getElementById('form1'); var oBtn = document.getElementById('btn'); oBtn.onclick = function() { //alert( oForm原创 2016-08-02 16:49:16 · 218 阅读 · 0 评论 -
onchange
无标题文档window.onload = function() { var oForm = document.getElementById('form1'); var oBtn = document.getElementById('btn'); //onchange : 当值发生改变的时候触发 //text : 当光标离开元素的时候原创 2016-08-02 16:50:21 · 1166 阅读 · 0 评论 -
表单事件
无标题文档window.onload = function() { var oForm = document.getElementById('form1'); //onsubmit : 当表单被提交的时候触发 oForm.onsubmit = function() { if (this.username.value ==原创 2016-08-02 16:51:07 · 200 阅读 · 0 评论 -
表单值
无标题文档window.onload = function() { var oForm = document.getElementById('form1'); var oBtn = document.getElementById('btn'); oBtn.onclick = function() { alert(oForm.se原创 2016-08-02 16:51:54 · 271 阅读 · 0 评论 -
BOM
无标题文档/*BOM : Browser Object Model 浏览器对象模型*/window.onload = function() { var aInput = document.getElementsByTagName('input'); var opener = null; aInput[0].onclick = funct原创 2016-08-02 16:52:30 · 194 阅读 · 0 评论 -
BOM属性
无标题文档//window.navigator.userAgent : 浏览器信息//alert( window.navigator.userAgent )if ( window.navigator.userAgent.indexOf('MSIE') != -1 ) { alert('我是ie');} else { alert('我不是ie');原创 2016-08-02 16:53:34 · 319 阅读 · 0 评论 -
getPos
无标题文档div {padding: 40px 50px;}#div1 {background: red;position: relative;}#div2 {background: green; position: relative;}#div3 {background: orange; position: relative;}window原创 2016-08-02 16:42:54 · 876 阅读 · 0 评论 -
元素宽高
无标题文档window.onload = function() { var oDiv = document.getElementById('div1'); /* width height style.width : 样式宽 clientWidth : 可视区宽 offsetWidth : 占位宽 */ ale原创 2016-08-02 16:41:53 · 216 阅读 · 0 评论 -
DOMchildNOdes
无标题文档window.onload = function() { var oUl = document.getElementById('ul1'); /* 元素.childNodes : 只读 属性 子节点列表集合 标准下:包含了文本和元素类型的节点,也会包含非法嵌套的子节点 非标准下:只包含元素类型的节点,ie7以下不会原创 2016-07-29 09:00:17 · 233 阅读 · 0 评论 -
DOM动态创建元素 有兼容性问题li a
HTML>http-equiv="Content-Type" content="text/html; charset=utf-8">无标题文档window.onload = function() { var oText = document.getElementById('text1'); var oBtn = document.getEl原创 2016-07-31 16:02:13 · 233 阅读 · 0 评论 -
BOM getElement
charset="UTF-8"> Title window.onload=function(){ var aUl=document.getElementById('ul1'); var oUl=document.getElementById('ul2'); var aLi=原创 2016-08-01 09:45:31 · 265 阅读 · 0 评论 -
DOM addClass MOveClass
html>lang="en"> charset="UTF-8"> 添加Class window.onload=function(){ var oDiv=document.getElementById('div1'); //addClass(oDiv,'box');原创 2016-08-01 14:45:10 · 659 阅读 · 0 评论 -
fristChild,lastChild,NextSiBling,previousSibling
HTML>http-equiv="Content-Type" content="text/html; charset=utf-8">无标题文档window.onload = function() { var oUl = document.getElementById('ul1'); /* 元素.firstChild : 只读原创 2016-08-02 16:35:23 · 353 阅读 · 0 评论 -
fristChild
HTML>http-equiv="Content-Type" content="text/html; charset=utf-8">无标题文档window.onload = function() { var oUl = document.getElementById('ul1'); //alert(oUl.firstElementChild原创 2016-08-02 16:36:26 · 187 阅读 · 0 评论 -
父结点
HTML>http-equiv="Content-Type" content="text/html; charset=utf-8">无标题文档window.onload = function() { var aA = document.getElementsByTagName('a'); for (var i=0; i; i++)原创 2016-08-02 16:37:53 · 424 阅读 · 0 评论 -
offsetParent
HTML>http-equiv="Content-Type" content="text/html; charset=utf-8">无标题文档div {padding: 40px 50px;}#div1 {background: red;}#div2 {background: green; zoom: 1;}#div3 {background: oran原创 2016-08-02 16:39:35 · 200 阅读 · 0 评论 -
offset,offsetTop
无标题文档div {padding: 40px 50px;}#div1 {background: red;}#div2 {background: green; position: relative;}#div3 {background: orange; position: relative;}window.onload = function(原创 2016-08-02 16:40:47 · 323 阅读 · 0 评论 -
优酷弹窗
无标题文档body {margin: 0;}#mask {background: black; opacity: 0.3; filter: alpha(opacity=30); position: absolute; left: 0; top: 0; display: none;}#box { width: 300px; height: 200px; pad原创 2016-08-02 16:56:40 · 1424 阅读 · 0 评论