title: Call function which was load in footer
body: <p>In a php foreach, I would convert a date using the client timezone.</p>
  
  <p>Actually, it doesn't work:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
    &lt;?php foreach ($topic as $post) { ?&gt;
      &lt;span id="date"&gt;
        &lt;script type='text/javascript'&gt;
          document.write(window.date('&lt;?php echo $date;?&gt;'));
        &lt;/script&gt;
      &lt;/span&gt;
    &lt;?php } ?&gt;
  
  &lt;script type='text/javascript'&gt;
    function date(VarDate) {
      var b = VarDate.split(/[: ]/g);
      var m = {jan:0, feb:1, mar:2, apr:3, may:4, jun:5, jul:6, aug:7, sep:8, oct:9, nov:10, dec:11};
      var isoTime = Date.UTC(b[7], m[b[1].toLowerCase()], b[2], b[3], b[4], b[5]);
      var date = new Date(isoTime).toLocaleDateString(navigator.language, {day: '2-digit', month:'2-digit', year:'2-digit'});
      var time = new Date(isoTime).toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'});
      return time + ' · ' + date;
      }
  &lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It works when I put the function before the loop but scripts are launched in footer to optimize the loading.</p>
  
  <p>I'm looking for something better. Sorry for my poor english.</p>