JavaScript - If Else
<p>I have JavaScript code for some function with If Else statements. But it is too long. I need to make it easy. So the problem is, how to reduce the line of codes in the following function? </p>

<pre><code> function clickFunction(e) {

            if(document.getElementsByName('insert_data1')[0].value == 1 || document.getElementsByName('insert_data1')[0].value == 0){
                document.getElementsByName('inputvalue1')[0].innerHTML = document.getElementsByName('insert_data1')[0].value;
                }
                else{
                    alert("Please enter 0 or 1 !!"); 
                }
            if(document.getElementsByName('insert_data2')[0].value == 1 || document.getElementsByName('insert_data2')[0].value == 0){
                document.getElementsByName('inputvalue2')[0].innerHTML = document.getElementsByName('insert_data2')[0].value;
                }
                else{
                    alert("Please enter 0 or 1 !!"); 
                }
            if(document.getElementsByName('insert_data3')[0].value == 1 || document.getElementsByName('insert_data3')[0].value == 0){
                document.getElementsByName('inputvalue3')[0].innerHTML = document.getElementsByName('insert_data3')[0].value;
                }
                else{
                    alert("Please enter 0 or 1 !!"); 
                }
            if(document.getElementsByName('insert_data4')[0].value == 1 || document.getElementsByName('insert_data4')[0].value == 0){
                document.getElementsByName('inputvalue4')[0].innerHTML = document.getElementsByName('insert_data4')[0].value;
                }
                else{
                    alert("Please enter 0 or 1 !!"); 
                }

                e.preventDefault(); 
                return false;
    }
</code></pre>