diff options
author | Mark Wells <mark@freeside.biz> | 2013-08-29 12:02:16 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-08-29 12:02:16 -0700 |
commit | 0dbb8441d07bea4d193966370f2349ba3346442d (patch) | |
tree | 14eb229bc8fb6a2b00c68bac33a5e8a01d0e697c /httemplate/elements/onload.js | |
parent | 3be960f69d36d11f6f080e9e28ed167996df4f26 (diff) |
better cross-browser onload handlers, fixes #24783
Diffstat (limited to 'httemplate/elements/onload.js')
-rw-r--r-- | httemplate/elements/onload.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js index bfa7eef94..c7bbbb283 100644 --- a/httemplate/elements/onload.js +++ b/httemplate/elements/onload.js @@ -12,11 +12,12 @@ Usage: </%doc> (function() { - var tmp = window.onload; - window.onload = function() { - if (typeof(tmp)== 'function') { - tmp(); - } + var myonload = function() { <% $m->content %> - }; + } + if ( window.addEventListener ) { + window.addEventListener('load', myonload); + } else if ( window.attachEvent ) { + window.attachEvent('onload', myonload); + } })(); |