Can I reference an external JavaScript file in a PHP file?
<p>I cannot seem to get this to work. I have a small JS file that switches banners depending on the time of day, but it seems that doing an external reference in my PHP file does not work. It works fine in an HTML page.</p>

<p>This is the code in the JavaScript file.</p>

<pre><code>function getStylesheet() {
    var currentTime = new Date().getHours();
    if (7 &lt;= currentTime &amp;&amp; currentTime &lt; 19) {
        document.write("&lt;img src='images/banner_day.jpg'&gt;");
    } else {
        document.write("&lt;img src='images/banner_night.jpg'&gt;");
    }
}

getStylesheet();
</code></pre>

<p>And here is the reference code I used to call the JavaScript file. Its in a PHP file.</p>

<pre><code>&lt;script src="http://beta.website.com/wp-content/themes/theme/scripts/banner.js"&gt;&lt;/script&gt;
</code></pre>

<p>Everything on the PHP page shows up in the browser, <strong>except</strong> for the banner that I tried to call with the script.</p>

<hr>

<p>Here is the entire PHP file code.</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="main"&gt;
&lt;div class="container"&gt;
&lt;div id="header"&gt;
&lt;div id="logo"&gt;
&lt;a href="http://bifffffdggdch.com"&gt;&lt;img src="http://beta.dfdfdf.com/wp-content/themes/asdafd/images/logo.png" /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;div id="shadow2"&gt;&lt;/div&gt;
&lt;div id="shadow1"&gt;&lt;/div&gt;
&lt;ul id="menu"&gt;
&lt;li&gt;&lt;a href=""&gt;df&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;df&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;fd df df&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;The asfdssd asdfds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;sf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;df&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;dfd&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id="slogan"&gt;&lt;big&gt;"fasfdsads2005."&lt;/big&gt;&lt;/div&gt;
&lt;div id="loginDiv"&gt;Login Panel Here&lt;/div&gt;
&lt;/div&gt;
&lt;div id="banner"&gt;
&lt;script src="http://beta.adsfasfasfd.com/wp-content/themes/adfadsf/scripts/banner.js"&gt;&lt;/script&gt;&lt;/div&gt;
&lt;div class="sidebar"&gt;
Sidebar Content&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt; 

blah
blah
blah
&lt;/div&gt;

&lt;div class="content"&gt;
Main Content

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;/div&gt;

&lt;div id="footer"&gt;
&lt;div class="container"&gt;
        &lt;div class="footer_column long"&gt;
          &lt;h3&gt;Cadsfadsfafdfsd.com All Rights Reserved&lt;/h3&gt;
          &lt;p&gt;dsafasdfdffadffadsdafsdfsadafsdfsadfas&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="footer_column2"&gt;
              &lt;h3&gt;More Links&lt;/h3&gt;   
              &lt;ul&gt;
              &lt;li&gt;&lt;a href="http://aadfsdfsdfa.
              com"&gt;asfsdfa&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="http://ItsNotch.
              com"&gt;ItsNotch&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="http://adfasfsfaf.
              com"&gt;adsfasf&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="http://twitter.
              com/safs"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="https://www.facebook.com/group.php?gid=10215yy20340498"&gt;Facebook Fan Page
              &lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
        &lt;/div&gt;
        &lt;div class="footer_column2"&gt;
              &lt;h3&gt;RSS&lt;/h3&gt;
              &lt;ul&gt;
              &lt;li&gt;&lt;a href=""&gt;RSS Feed&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;What is RSS?&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
        &lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
