grazie 1000 ho risolto

ma che comdo sarebbe se non ci fosse un ma....

questo è il codice che ho fatto, premendo i link 1 e 2 e se metto il comando onload nel body tag, il tutto funziona ma sapreste dirmi se è possibile e se si come funzionare nel div direttamente come qui sotto riportato

codice:
<script>
var myRequest = null;

function CreateXmlHttpReq2(handler) {
  var xmlhttp = null;
  try {
    xmlhttp = new XMLHttpRequest();
  } catch(e) {
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  xmlhttp.onreadystatechange = handler;
  return xmlhttp;
}

function myHandler2() {
    if (myRequest.readyState == 4 && myRequest.status == 200) {
        e = document.getElementById("galleryname");
        e.innerHTML = myRequest.responseText;
    }
}

function galleryimglist(gid) {
    myRequest = CreateXmlHttpReq2(myHandler2);
    myRequest.open("GET","gallery.php?gid="+gid);
    myRequest.send(null);
}
</script>

1 2
<div id="galleryname" onload="javascript:galleryimglist(0);"></div>