document.getElementById(
'
span1
'
).attributes[
'
time
'
].nodeValue;
有时候在html中自定义属性能够方便我们,比如<span id='span1' time='2008-8-8'>hello</span>,通常在ie中获取time的办法是:document.
getElementById('span1').time就行,但是这个方法在firefox下不管用,兼容的做法是这样的:
转载于:https://www.cnblogs.com/vagerent/archive/2008/05/07/1186223.html