封装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);
};
封装document.getElementById(id)的更多相关文章
- document.getElementById("id").value与$("#id").val()之间的区别
		本文链接:https://blog.csdn.net/mottohlm/article/details/78364196....今天在项目中遇到这么一个JS报错:原因是代码中有这么一段:对,就是var ... 
- Id.value与document.getElementById("Id").value的区别
		如果标签Id在Form表单里面的话,直接Id.value就不能用了,而是要用Form.Id.value来取值或设置值 所以最好用document.getElementById("Id&quo ... 
- jquery中的$("#id")与document.getElementById("id")的区别
		以前一直认为jquery中的$("#id")和document.getElementByIdx_x("id")得到的效果是一样的,今天做特效的时候才发现并不是这 ... 
- 获得输入框的文本document.getElementById('id').value;
		<input id="demo" type="text" value="" > x=document.getElementByI ... 
- function $(id){ return document.getElementById(id); }导致所有的js不能用解决办法。。。。
		function $(id){ return document.getElementById(id); } document.getElementById(id) 是获得id这个元素的. 相当于定义了 ... 
- document.getElementById(“id”)与$("#id")的区别
		document.getElementById("id")可以直接获取当前对象, jQuery利用$("#id")获取的是一个[object Object],需 ... 
- function $(id) {   return typeof id === "string" ? document.getElementById(id) : id; }
		function $(id) { return typeof id === "string" ? document.getElementById(id) : id; } 这句代 ... 
- jquery 中的 $("#id") 与 document.getElementById("id") 的区别
		以前没注意过,认为jquery 中的 $("#air") 与 document.getElementById("air") 是一回事,指的是同一个东西.在今天写 ... 
- Document.getElementById 与 $('#id')的区别
		一直认为jquery中的$("#id")和document.getElementByIdx_x("id")得到的效果是一样的,今天才发现并不是这么一回事,通过测 ... 
随机推荐
- MEF(Managed Extensibility Framework)有选择性地使用扩展组件
			在"MEF(Managed Extensibility Framework)使用全部扩展组件"中,客户端应用程序调用了所有的扩展组件,而且如果有新的扩展组件加入,必须先关闭程序,再 ... 
- 【spring cloud】【IDEA】【maven】spring cloud多模块在idea上使用maven插件打包报错:程序包XXX不存在
			>>>>spring cloud 多模块 >>>>在idea上使用maven插件打包,欲打包成jar包后 进行部署 >>>> 报 ... 
- ConcurrentBag扩展 批量加入
			public static void AddRange<T>(this ConcurrentBag<T> @this, IEnumerable<T> toAdd) ... 
- MyBatis的动态SQL详解-各种标签使用
			MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑. MyBatis中用于实现动态SQL的元素主要有: if choose(when,otherwise) ... 
- Win8 下配置Java开发环境
			背景: 大学期间学习过一段时间的JavaEE.不算很熟悉. 后来学习并在工作中很多其它是iOS开发,iOS的水平属于中上. 对技术已经有一定熟知程度. 近期为了写一些东西,须要用到Java写后台. 流 ... 
- 设置IE浏览器指定的功能
			if ($.browser.msie) { // Internet Explorer is a sadist. } 
- coursera课程Text Retrieval and Search Engines之Week 3 Overview
			Week 3 OverviewHelp Center Week 3 On this page: Instructional Activities Time Goals and Objectives K ... 
- hdu 4107 Gangster(线段树,时间卡得很严)
			这道题目的数据卡得好厉害. 题目明显是考察线段树延迟标记的,但是因为要考虑到p的值,这种延迟是有条件的:在该节点下所有的数据对于p都应该位于p的同一侧.要么都比p大,要么都比p小. 开始的时候我用一个 ... 
- [19] 半球形(Hemisphere)图形的生成算法
			顶点数据的生成 bool YfBuildHemisphereVertices ( Yreal radius, Yuint slices, Yuint stacks, YeOriginPose orig ... 
- 【转】一种新型的Web缓存欺骗攻击技术
			为了减少WEB响应时延并减小WEB服务器负担,现在WEB缓存技术已经用的非常普遍了,除了专门的CDN,负载均衡以及反向代理现在也会缓存一部分的网页内容.这里我要介绍一种WEB缓存欺骗攻击技术,这种攻击 ... 
