mbeals Posted November 20, 2007 Share Posted November 20, 2007 I have a website that is using ajax to dynamically load data from a database (formatted by a php script) into a set of div tags. So when you filter the data or refresh (with a refresh button) the table is updated but the whole page is not reloaded. Anyway, to make this page display a default table, I need to run the ajax script (which executes the php and replaces the contents of the div tag with the results) when the page loads. To take care of this I have the following: function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(loadlog()) all within script tags, of course. The loadlog function is the ajax function which works fine when you call it via a button or a link or whatever else. This code works fine in firefox, but will not run the loadlog() function when the page loads in IE7. Is there a trick to IE7 or something I need to add to get it to work? Link to comment https://forums.phpfreaks.com/topic/78085-ie-7-onload-function/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.