Note that there are some explanatory texts on larger screens.

plurals
  1. POInclude several HTML pages with JavaScript into one PHP page
    primarykey
    data
    text
    <p>Earlier I asked about fixing the clock below and BAM! The solution was nearly instantaneous. Since then I have successfully added several of these clocks to a single PHP page. One for Tokyo, one for London, one for Madrid and one for Denver - great. My problem (now) is that the only way I've been able to do this is to "include" individual PHP pages that are really made up of the <a href="http://en.wikipedia.org/wiki/HTML" rel="nofollow">HTML</a> below. If you "View Source" on the PHP page, you see multiple HTML pages embedded within it complete with opening and closing HTML, head and body tags.</p> <p>My question: is it OK to have multiple HTML pages embedded within one another? It works across all the major browsers (<a href="http://en.wikipedia.org/wiki/Google_Chrome" rel="nofollow">Google Chrome</a>, Firefox, Internet&nbsp;Explorer, <a href="http://en.wikipedia.org/wiki/Safari_%28web_browser%29" rel="nofollow">Safari</a> and <a href="http://en.wikipedia.org/wiki/Opera_%28web_browser%29" rel="nofollow">Opera</a>). Should I be going about this in a different way? I can't seem to call the header information within the head of my PHP file and make it work (specifically the call to jQuery &amp; scripts/jclock.js). As long as it loads on the first clock it isn't necessary on the ones following, but I can't seem to get rid of the HTML and just use the JavaScript code per clock and echo '<code>&lt;div id='us_pacific"&gt;&lt;/div&gt;</code>' (which is how the clock gets printed to the page within the HTML within the body tags.)</p> <p>Any thoughts?</p> <p>Here is the clock:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts/jclock.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="css/homepage.css"&gt; &lt;script type="text/javascript"&gt; $(document).ready( function() { if ($('#us_pacific .time').length&gt;0){ $('#us_pacific .time').remove(); } //Set the offset here var offset = -7; if (offset == '') return; $('#us_pacific').append('&lt;div class="time"&gt;&lt;/div&gt;'); var options = { format:'&lt;span class=\"dt\"&gt;%a, %d %b %H:%M&lt;/span&gt;', timeNotation: '12h', am_pm: true, utc:true, utc_offset: offset } $('#us_pacific .time').jclock(options); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="us_pacific"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload