<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> attribute</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
#box{
width:100px;
height:100px;
background: green;

}
</style>
</head>
<body>
<div id="box" style='' bbb='helloworld' >div</div>
<script type="text/javascript">
/*
[]在属性中的运用

obj['style']['height'] ='250px';

var str = oBut.innerHTML;
obj.style[str] ='250px';

属性值在不确定的时候采用[]

attribute节点属性
attribute优势:可以操作.还有[]操作不了的非法的HTML属性
obj.getAttribute(name) 获取节点的值
obj.setAttribute(name,value) 设置节点属性的值
obj.hasAttribute(name) 是否有name属性,true=>有,false=无
obj.removeAttribute(name) 移除 name属性
*/
var obj = document.getElementById('box');
//console.log(obj['bbb'])//undefined
//console.log( obj.getAttribute('style') ); //获取节点属性的值
//console.log( obj.setAttribute('ccc',999) ); //设置节点属性的值
//console.log( obj.hasAttribute('bbb') ); //有 true, 没有 false
console.log( obj.removeAttribute('bbb') ); //移除节点属性
</script>
</body>
</html>