I have select dropdowns which are created in loop and an onchange event is triggered when an option is selected. get() function is an ajax call.
HTML code:
  <select id="id1" name="name[]" onChange="get(1)">
  <option>....</option>
  </select>
  <select id="id2" name="name[]" onChange="get(2)">
  <option>....</option>
  </select>
  <select id="id3" name="name[]" onChange="get(3)">
  <option>....</option>
  </select>
ajax code:
 url = "ajax.php?item=";
    function get(id) {
        var sId = document.getElementById("id"+id).value;
        http.open("GET", url + escape(sId) + "&did="+id, true);
        http.onreadystatechange = function() {   
                if (http.readyState == 4) {
                    if(http.status==200) {
                        var results = http.responseText;
                        document.getElementById("showdiv"+id).innerHTML = results;
                        document.getElementById('ajaxdiv'+id).style.display = '';
                        document.getElementById('showdiv'+id).style.display = '';
                        document.getElementById('price'+id).focus();
                    }
                }
            }
        http.send(null);
    }
    function getHTTPObject() {
        var xmlhttp;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            if (!xmlhttp) {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
        }
        return xmlhttp;
    }
    var http = getHTTPObject();
This works fine when I select manually, what I want now is, this should all trigger by itself on the page load.
I tried with window.onload but only one and the first option shows up. What should I use to trigger all onchange events.
 
     
     
     
    