<script type="text/javascript">
//小型代码库YJ封装
var YJ = {
//根据id获取元素
getId:function(id){
return document.getElementById(id);
},
//设置css样式
setCss:function(id,key,value){
document.getElementById(id).style[key] = value;
},
//设置属性值
setAttr:function(id,key,value){
document.getElementById(id)[key] = value;
},
//设置内容
setHtml:function(id,html){
document.getElementById(id).innerHtml = html;
},
//事件架构
on:function(dom,type,fn){
dom.addEventListener?dom.addEventListener(type,fn.false):dom.attachEvent('on'+type,fn);
}
}
</script>