Edit in JSFiddle

var _MS_PER_DAY = 1000 * 60 * 60 * 24;

// a e b sono oggetti Data
function dateDiffInDays(a, b) {
  // Esclude l'ora ed il fuso orario
  var utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
  var utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());

  return Math.floor((utc2 - utc1) / _MS_PER_DAY);
}

function getDateDiffInDays() {
 var YA = document.getElementById("YA").value
 var MA = document.getElementById("MA").value
 var DA = document.getElementById("DA").value
 var YB = document.getElementById("YB").value
 var MB = document.getElementById("MB").value
 var DB = document.getElementById("DB").value

 var date1 = new Date(YA + "/" + MA + "/" + DA);
 var date2 = new Date(YB + "/" + MB + "/" + DB);
    
 var el = document.getElementById("date_diff")
 el.innerHTML = dateDiffInDays(date1, date2)    
}
<div id="dateA">
    <select id="YA">
        <option value="2012">2012</option>
        <option value="2013">2013</option>
        <option value="2014">2014</option>
    </select>
    <select id="MA">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>  
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>          
    </select>
    <select id="DA">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>  
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>  
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>  
        <option value="30">30</option>
        <option value="31">31</option>        
    </select>     
</div>
<div id="dateA">
    <select id="YB">
        <option value="2012">2012</option>
        <option value="2013">2013</option>
        <option value="2014">2014</option>
    </select>
    <select id="MB">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>  
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>          
    </select>
    <select id="DB">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>  
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>  
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>  
        <option value="30">30</option>
        <option value="31">31</option>        
    </select>     
</div>
<div><button onclick="getDateDiffInDays();">Calcola la differenza in giorni</button></div>
<div id="date_diff"></div>