change from deny specific extensions to allow only specific extensions
<p>I am new to asp.net. I have this code:</p>

<pre><code>function onSubmitForm() {
    var formDOMObj = document.frmSend;
    if (formDOMObj.attach1.value == "" &amp;&amp; formDOMObj.attach2.value == "" &amp;&amp; formDOMObj.attach3.value == "" &amp;&amp; formDOMObj.attach4.value == "" )
        alert("Please press the Browse button and pick a file.")
    else
        return true;

    var extension = lcase(right(formDOMObj.attach1.value,4);  
    if (extension == ".exe") || extension == ".html")
        alert("Extension not allowed.")

    return false;
</code></pre>

<p>}</p>

<p>I'd like to change it to allow only certain extensions instead of excluding them. I can do this by flipping the if but I'd like to change it to work with an array or list but I'm not sure how to do this...</p>

<p>Can someone help me by pointing me in the right direction?</p>
