As title say, i just have blank screen when trying to add the geocoding Function to my Map. If i leave the map alone with the marker it works fine. But in the moment i add the geocode Function it just send me a Blank Screen. Here is the code :
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API v3: esempio base</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
<script type="text/javascript">
var initialize = function() {
var latlng = new google.maps.LatLng(42.745334,12.738430);
var options = { zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map'), options);
var marker = new google.maps.Marker({ position: latlng,
map: map,
title: 'W Le DONNE' });
var createMap = function() {
searchAddress();
var address = document.getElementById("address").value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( {'address': address}, function(results,status) {
if (status == google.maps.GeocoderStatus.OK) {
var options = {
zoom: 12,
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
else {
alert("Problema nella ricerca dell'indirizzo: " + status);
}
});
}
var searchAddress = function(){
document.getElementById("submit").onclick = function() {
createMap();
}
}}
window.onload = createMap;
</script>
</head>
<body style="margin:0; padding:0;">
<div>
<input id="address" type="textbox" value="Viale Franco Angeli, 5 - Roma">
<input id="submit" type="button" value="trova indirizzo sulla mappa">
</div>
<div id="map" style="width:100%; height:100%"></div>
</body>
</html>