title: Ajax triggering body's onLoad event
body: <p>My whole page is loading again whenever I make a ajax call to load a div.
  I have noticed that 'body onload=init()' onload event is getting triggered on ajax response and all the initialization is happening again. I don't want that to happen.
  Is there a way by which only div is loaded through ajax call.</p>
  
  <pre><code>&lt;body onload="init()"&gt;
  .....
  .....
  &lt;div&gt;...&lt;a href="" onclick="saveView('more')"&gt;&lt;b&gt;More&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>main.js</p>
  
  <pre><code>function saveView(arg){
      if(arg=="more"){
              ajaxGet(baseRef+"all.html", loadList);
  
      }else{
              ajaxGet(baseRef+"all-A.html", loadList);
  
      }
  function init(){
  .....
  }
  
  function ajaxGet(url, responseHandler)
  {
      var page_request = false;
  
      if (window.XMLHttpRequest &amp;&amp; !(window.ActiveXObject &amp;&amp; window.location.protocol == "file:")) { 
                  // use this only if available, and not using IE on a local filesystem
          page_request = new XMLHttpRequest();
          }
      else if (window.ActiveXObject) { // older versions of IE, or IE on a local filesystem
          try {
              page_request = new ActiveXObject("Msxml2.XMLHTTP");
          } 
          catch (e){
              try{
                  page_request = new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (e){
              }
          }
      }
      else {
          alert("Your browser does not support XMLHTTP.");
          return false;
      }
  
  
      page_request.onreadystatechange=function() {
          if(page_request.readyState==4) {
                          // on local machines the status for success is 0. on web servers it is 200
              if(page_request.status==200 || page_request.status==0) {
                  responseHandler(page_request);
              }
          }
      }
  
      page_request.open('GET', url, true);
      page_request.send(null);
  }
  
  function loadList(page_request){
      document.getElementById("list").innerHTML=page_request.responseText;
      Loaded = true;    
      try{
          if(pLoaded) 
              doFilterStateChange1();
          }catch(e)
          {
          }
      setTimeout("restoreScrollTop()", 1000);
  }
  </code></pre>