Javascript function returning just 1 value instead of an array of values
<p>I am trying to find out page loading time by using iframes. I have an array of urls, that i put into an array of iframes, and then i get the loadtime of each iframe by using javascript. My problem - my time values is not an array, so it just shows 1 value (it shows value of 1st frame then second later it replaces it with value of 2nd frame on top of it).</p>

<pre><code>   &lt;html&gt;
    &lt;body&gt;   
    &lt;center&gt;
    &lt;?php 
    $url = array('example.com', 'example2.com');
    foreach($url as $i){ 
    ?&gt;
    &lt;iframe onload="pageloadingtime();" width="505" height="505" scrolling="no" security="restricted" src="&lt;?php echo "http://www.".$i; ?&gt; "&gt;&lt;/iframe&gt;
    &lt;?php
    } 
    ?&gt;
    &lt;div id="loadingtime"&gt;&lt;/div&gt;
    &lt;/center&gt;
    &lt;/body&gt;
    &lt;script type="text/javascript"&gt;    
    beforeload = (new Date()).getTime();
    function pageloadingtime()
    {
        afterload = (new Date()).getTime();
        secondes = (afterload-beforeload)/1000;
        document.getElementById("loadingtime").innerHTML = "&lt;font color='red'&gt;(Page took " + secondes + " seconds to load)&lt;/font&gt;";
    }   
    &lt;/script&gt;
    &lt;/html&gt;
</code></pre>

<p>In this code i make an array of urls ($url), run a foreach cycle making as many iframes as there are urls, and then using javascript i count the page loading time. After i get the loading time i put it into the "loadingtime" div. But like i said it only puts 1 value instead of putting an array of values. </p>

<p>changed it to this, but now its not displaying anything:</p>

<pre><code>beforeload = (new Date()).getTime();
function pageloadingtime()
{
    var afterload = (new Date()).getTime();
    secondes = (afterload-beforeload)/1000;
    document.getElementById("loadingtime1").innerHTML += "&lt;font color='red'&gt;(Page took " + secondes + " seconds to load)&lt;/font&gt;&lt;br&gt;";
}
</code></pre>
