title: Javascript: how to find the content of h3 header with id "map"?
body: <p>I have a web page with a Google Map which works well. Instead of having the city name hardcoded to "Bochum" there, I'd like to find the header </p>
  
  <pre><code>&lt;h3 id="city"&gt;&lt;i&gt;Bochum&lt;/i&gt;&lt;/h3&gt;
  </code></pre>
  
  <p>and use that value in my init() function. </p>
  
  <p>I'm probably missing something minor in the code below. Please help me and please refer me to the API reference for such a "child", my Javascript skills are very rusty. </p>
  
  <p>Also I wonder, how could I pass one more value through my h3 header, like the color for my marker?</p>
  
  <p>Thank you!
  Alex</p>
  
  <p><img src="https://i.stack.imgur.com/XjNxy.png" alt="alt text"></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;style type="text/css"&gt;
          h1,h2,h3,p { text-align: center; }
      #map { width: 400; height: 200; margin-left: auto; margin-right: auto; }
  &lt;/style&gt;
  &lt;script type="text/javascript"
      src="http://maps.google.com/maps/api/js?sensor=false"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function init() {
          for (var child in document.body.childNodes) {
                  child = document.body.childNodes[child];
                  if (child.nodeName == "H3")
                          alert(child);
          }
  
      // use the #city value here instead
      city = 'Bochum';
  
      if (city.length &gt; 1)
          findCity(city);
  }
  
  function createMap(center) {
      var opts = {
          zoom: 9,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
      };
      return new google.maps.Map(document.getElementById("map"), opts);
  }
  
  function findCity(city) {
      var gc = new google.maps.Geocoder();
      gc.geocode( { "address": city}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              var pos = results[0].geometry.location;
              var map = createMap(pos);
              var marker = new google.maps.Marker({
                  map: map, 
                  title: city,
                  position: pos,
              });
          }
      });
  }
  &lt;/script&gt;
  &lt;head&gt;
  &lt;body onload="init();"&gt;
  &lt;h3 id="city"&gt;&lt;i&gt;Bochum&lt;/i&gt;&lt;/h3&gt;
  &lt;div id="map"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>