That works now, but I have some issues with other functions.
Apparently, the problem is not in loading the external javascript
files as I previously thought, they load correctly just with .load()
function.
Problem is in "window.onload" function.

This part of the script is causing the problem:

window.onload = init;
function init() {
var ajax = getXMLHttpRequestObject();
        if (ajax) {
                if (document.getElementById('results')) {
                document.getElementById('loginform').onsubmit = function() {

                var postdata = "&name=" + 
document.getElementById('form1').value +
                "&pass=" + document.getElementById('form2').value
                + "&message=" + document.getElementById('message').value;
                if (document.getElementById('cbx').checked) { postdata +=
"&chkbx=1"; }

        ajax.open('post', 'bazajax.php', true);
        ajax.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
                ajax.onreadystatechange = function() {
                        handler(ajax);
        }
        ajax.send(postdata);
        return false;
        } // end anonymous postdata
        } // end DOM
} // end if
} // end init

If I delete window.onload = init and init function, everything will
work correctly (in FF & IE, but not in Chrome) when loaded through
jquery's .load(). But if I start the page manually, like  "edit.php?
edit=about", it will not, because it cannot initialize.

Is there a way for me to code so that it'll work in both ways and in
all browsers?
I see the trouble is with "onload" event, because it does not know
when to fire as the page is loaded through jquery's ajax.

Thanks.

On Oct 13, 2:31 pm, joel boonstra <[EMAIL PROTECTED]> wrote:
> On Oct 12, 5:41 pm, ivframes <[EMAIL PROTECTED]> wrote:
>
> > I have a page that loads with jquery's .load() function.
> > However, that page is a form with two custom JS files attached.
> > When I load it separately, the JS code works. However, when used
> > with .load(), it does not.
>
> > What I'm missing here?
>
> Can you post some code so we can see how the custom JS files are
> attached to the content you pull in with .load()?
>
> --
> joel

Reply via email to