The thing you want to do is called geocoding, see the page on Google Geocoding API
Update:
Probably you will need this function. It is able to iterate over an array and execute a callback after each geocoding return:
function locate(address, callback) {
var geocoder = new google.maps.Geocoder(),
latlong = [];
geocoder.geocode({
address: address[0]
}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
latlong.push([results[0].geometry.location.Ma, results[0].geometry.location.Na]);
address.shift();
if (typeof callback === 'function') callback(latlong);
if (address.length === 0) {
return;
} else {
locate(address, callback);
}
}
});
}
/*
* Sample use
*/
locate(['1 Infinite Loop, Cupertino, CA', '1600 Amphitheatre Parkway, Mountain View, CA'], function(result) {
console.log(result);
});
Don't forget to include Google Maps API JS file before your script.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>