0
点赞
收藏
分享

微信扫一扫

封装document.getElementById(id)

 

CreateTime--2016年12月18日11:42:45
Author:Marydon
封装document.getElementById(Id)方法

<script type="text/javascript">
var xyhsoft = new Object();
xyhsoft.dom = new Object();
$Get = $get = xyhsoft.dom.GetElement = function(Id) {
return(typeof(Id) == "string" ? document.getElementById(Id): Id);
};
</script>

//测试
window.onload = function() {
console.log($get("aa").value);
}

<input type="text" value="zhangsan" id="aa"/>

UpdateTime--2017年10月31日14:50:38

$get = function(id) {
return document.getElementById(id);
};

 

 


举报

相关推荐

0 条评论