title: Google Maps API Javascript; TypeError a is null
body: <pre><code>var map;
  function initialize() {
          var mapOptions = {
              center: new google.maps.LatLng(25.825421, 0.898438),
              zoom: 15,
              mapTypeId: google.maps.MapTypeId.ROADMAP,
              };
  
          map = new google.maps.Map(document.getElementById('map-canvas'),
              mapOptions);
  
          google.maps.event.addListeneer(map, 'click', function(x) {
              ylat.value = x.latLng.lat();
              ylong.value = x.latLng.lng();
          });
      }
          var ylat = document.getElementById('lat');
          var ylong = document.getElementById('loong');
  
          function addMarker() {
              var lat = ylat.value;
              var loong = ylong.value;
  
          if(!lat || !loong) return;
  
          var coordinate = new google.maps.LatLng(lat, loong);
          var marker = new google.maps.Marker({
              map: map,
              position: coordinate
          });
      }
  
          google.maps.event.addDomListener(document.getElementById('search'), 'click', addMarker);
          google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>
  
  <p>When I run this on Firefox, Firebug tells me "TypeError: a is null" I have looked this up on various websites and on here as well. I don't have the slightest clue on how to fix it. Please help! </p>