Subject: Override IE4 legacy document.all()
Author: WebSpider
Posted on: 07/24/2006 09:42:39 PM
Since IE5, document.getElementById() is introduced to replace document.all(), in order to comply with W3c consortium's DOM. What happens if clients, like our grandmas, are still using the older version IE4? Here is the solution:
<script language="JavaScript">
if(!document.getElementById && document.all) {
document.getElementById = function(id) {
return document.all[id];
}
}
</script>
By adding the above into your DOM handling script, you can just simply ignore the document.all() legacy problem.
For example,
http://www.forumeasy.com/forums/thread.jsp?tid=115378086669&fid=javaprof25
References: