Have link appear only if href file exists
<p>I have a generic index.html file that has an unordered list of links. I only want the links to be visible if the file that they link to exists. </p>

<pre><code>    &lt;ul&gt;
    &lt;li&gt;&lt;a class="button" href="text-1.htm"&gt;Text 1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a class="button" href="text-2.htm"&gt;Text 2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a class="button" href="text-3.htm"&gt;Text 3&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
</code></pre>

<p>Is this possible with JavaScript, or would I have to use PHP?</p>