封装document.getElementById(id)

it2025-05-01  8

CreateTime--2016年12月18日11:42:45Author: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); };

 

 

 

转载于:https://www.cnblogs.com/Marydon20170307/p/6541298.html

最新回复(0)