does the onload element have a limited amount of function call

call javascript function after page load complete
call javascript function after div load
jquery onload
window.onload is not a function
jquery after page load
javascript execute after all scripts loaded
jquery run script after everything loaded
addeventlistener onload

guys i don't know what is happening here

<body onload="plusSlides0(-1);plusSlides1(-1);plusSlides2(-1);plusSlides3(-1);change();">

the last function

change();

isn't running but if i put it at the begining or anywhere else it runs, but then the last function won't run, does it mean i can only call four functions in the onload element and if so how can i call five functions. ... by the way i have already tried putting all of them in one function but the same thing is happening thanks!!!

I assume change in your example is a function of yours, you're not trying to call a change method on the body element (it doesn't have one).

does the onload element have a limited amount of function call

No, you can have an arbitrary amount of code there. You shouldn't, but you can.

If change() at the end there isn't working, it tells you that one of the previous functions threw an error, abruptly terminating the load event callback.

i have already tried putting all of them in one function but the same thing is happening

That's a step in the right direction (but keep reading):

onload="theOneFunction()"

and then

function theOneFunction() {
    plusSlides0(-1);
    plusSlides1(-1);
    plusSlides2(-1);
    plusSlides3(-1);
    change();
}

better still, though, would be to hook up the handler with addEventListener:

document.body.addEventListener("load", function() {
    plusSlides0(-1);
    plusSlides1(-1);
    plusSlides2(-1);
    plusSlides3(-1);
    this.change();
});

but, either way, you have to ensure that those functions don't throw errors, or that you catch them.

You could catch the error:

document.body.addEventListener("load", function() {
    try {
        plusSlides0(-1);
        plusSlides1(-1);
        plusSlides2(-1);
        plusSlides3(-1);
    } catch (e) {
        // ...report/handle the error...
    }
    change();
});

which would only mean the functions in the try block after the one throwing wouldn't run, but change() still would.

But really, best to find out why they're throwing and deal with that.

onload Event, onload is most often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS� The onload event can be used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information. The onload event can also be used to deal with cookies (see "More Examples" below).

Maybe one of your functions is breaking. I tried below and it's working

<script>
function plusSlides0(val){
    console.log(val);
}
function plusSlides1(val){
    console.log(val);
}

function plusSlides2(val){
    console.log(val);
}
function plusSlides3(val){
    console.log(val);
}

function change(){
    console.log('hello');
}
</script>
<body onload="plusSlides0(-1);plusSlides1(-1);plusSlides2(-1);plusSlides3(-1);change();">

Page: DOMContentLoaded, load, beforeunload, unload, The lifecycle of an HTML page has three important events: script > function ready ( ) { alert ( 'DOM is ready' ) ; // image is not yet runs when the document is loaded, so it can see all the elements, a <script> tag, it needs to execute before continuing building the DOM. The data is limited by 64kb. The onload attribute can be used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information. The onload attribute can also be used to deal with cookies (see "More Examples" below).

You need to do that differently:

   <script type="text/javascript">
        document.body.addEventListener("load", function LoadAll() {
            plusSlides0(-1);
            plusSlides1(-1);
            plusSlides2(-1);
            plusSlides3(-1);
            try { change(); } catch (e) { console.log(e.toString()); }
        }); 
    </script>

.load(), Note: Prior to jQuery 3.0, the event handling suite also had a method named . load() . if the document does not contain an element with id="result" — the Ajax request will not When calling .load() using a URL without a suffixed selector expression, the Global Ajax Event Handlers � Helper Functions � Low-Level Interface� I think you can see there is a form to select the date ranges and click on the Go button, it will call that file again with records that are in that date range whereas the on the onload call it

JavaScript Onload Event: Run JavaScript on Page Load Explained, They do have a point - if you want to master any JavaScript function, property, or event, you need to practice. Therefore, we suggest you play� The onload attribute can be used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information. Applies to The onload attribute is part of the Event Attributes , and can be used on the following elements:

Event handlers, For example, a button click is an event, as is giving focus to a form element. You can define Event handlers, scripts that are automatically executed when an event For example, suppose you have created a JavaScript function called compute. change, User changes value of text, textarea, or select element, onChange. The onLoad attribute is an event handler that instructs the browser to run a script when the visitor loads the page. This is commonly used to forward the visitor to another page, but can be used to trigger pop-up boxes, or execute a script based on the user’s browser version.

JavaScript: Events and Listeners, In a January 2013 article titled LDS Church announces limited layoffs, You can set specific functions to run when the user performs an event. tag to ensure the elements load first, but let's say you need your script to run earlier — before run this function nameField.onfocus = function() { //if the field has the value "your� I have a function that loads with the onload command. Is there a subsitute for this? I have an AJAX call so sometimes content gets loaded on the page without the onload event being triggered but I need it to go to this function when the AJAX displays the new content. Any ideas? If it makes a difference, the AJAX is calling a PHP page. Thanks in

Comments
  • thanks you answered all my questions i really appreciate
  • Yes you are right..Needs to be separated from others