最近看JS代码,发现不少人问getElementByIdx_x是什么函数,其实就是个getElementById自定义函数
函数代码:
复制代码 代码如下:
document.getElementByIdx_x=function(id){
if(typeof id =='string')
return document.getElementById(id);
else
throw new error('please pass a string as a id!')
}
实例代码:
复制代码 代码如下:
9
以上就是getElementByIdx_x js自定义getElementById函数的详细内容,更多请关注本站其它相关文章!