Jump to content

IE 7 onload function.


mbeals

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.