function product1(id){
 var xmlHttp;
 var url='ajax/product1.php?id='+id;
 if (window.ActiveXObject) { 
  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 } 
 else if (window.XMLHttpRequest) { 
  xmlHttp = new XMLHttpRequest();
 } 
 
 xmlHttp.onreadystatechange = function(){
  if(xmlHttp.readyState == 4){
   document.getElementById('product1').innerHTML = xmlHttp.responseText;
  }
 }

 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
}                                                      
   
<!--產品左邊的選項-->
function product2(id){
 var xmlHttp;
 var url='ajax/product2.php?id='+id;
 if (window.ActiveXObject) { 
  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 } 
 else if (window.XMLHttpRequest) { 
  xmlHttp = new XMLHttpRequest();
 } 
 
 xmlHttp.onreadystatechange = function(){
  if(xmlHttp.readyState == 4){
   document.getElementById('product2').innerHTML = xmlHttp.responseText;
  }
 }

 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
}                              