Chris Knowles wrote: > you need this... > http://dean.edwards.name/weblog/2006/06/again/ >
in fact, I incorporated this into my own library - I found the order in which the code tests the different browsers to matter - I think if I remember rightly I had an issue with safari on windows if the safari test came before the IE test. Anyway, this is my slightly changed version ... var onDomload = function() { /* for Internet Explorer */ /[EMAIL PROTECTED] @*/ /[EMAIL PROTECTED] (@_win32) return function(func) { document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { func(); // call the onload handler } }; return; }; /[EMAIL PROTECTED] @*/ /* for Safari */ if (/WebKit/i.test(navigator.userAgent)) { // sniff return function(func) { var _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { func(); // call the onload handler } }, 10); return; }; } /* for Mozilla/Opera9 */ if (document.addEventListener) { return function(func) { document.addEventListener("DOMContentLoaded", func, false); return; }; } /* for other browsers */ return function(func) { window.onload = func; }; }(); then use... onDomload( function() { ... } ); -- Chris Knowles ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *******************************************************************