Posted in Javascript onJanuary 24, 2012
函数代码:
document.getElementByIdx_x=function(id){ if(typeof id =='string') return document.getElementById(id); else throw new error('please pass a string as a id!') }
实例代码:
<div id='box'>9</div> <script> document.getElementByIdx_x=function(id){ if(typeof id =='string') return document.getElementById(id); else throw new error('please pass a string as a id!') } var timer = window.setInterval(function(){ document.getElementByIdx_x('box').innerHTML = parseInt(document.getElementByIdx_x('box').innerHTML) - 1; if(parseInt(document.getElementByIdx_x('box').innerHTML) < 0) { window.clearInterval(timer); window.location = 'https://3water.com'; } }, 1000); </script>
getElementByIdx_x js自定义getElementById函数
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@