2013-03-04 198 views
0

我正在使用以下代碼來顯示html模式彈出窗口。它顯示絕對好。唯一的問題是我的div中的一個字段是日期時間字段,我正在使用jquery datetimepicker模塊。但是當我點擊日曆圖像時,日曆下拉菜單顯示在主HTML頁面中,而不是彈出的HTML頁面上。任何人都可以看看我的代碼,並給我建議我在這裏做錯了什麼。Html模式彈出窗口

<div id="shade" ></div> 
    <div id="modal"> 
     <label> Summary: </label> 
     <input type="text" name="summary" id="summary" style="width: 500px;"/> <br> 
     </select><br> 
     <label> priority: </label> 
     <select id="change_type" name="change_type" style="width: 150px;"> 
      <option value ="Minor"> Minor</option> 
      <option value ="Medium"> Medium</option> 
      <option value ="Major"> Major</option> 
     </select> <br> 
     <label> Due Date: </label> 
     <input type="text" name="duedate" id="duedate" value="{{ request.args['duedate'] }}" align ="center" ondblclick="value=''"/> 
     <img src="{{ url_for('static', filename='cal.gif')}}" style="cursor: pointer; display: inline-block;" onclick="javascript:NewCssCal('duedate','yyyymmdd','dropdown',true,'24')"/><br> 

     <button id="id" style="position: absolute;left:600px;">Please verify</button> 
     <button id="Cancel" onclick="" style="position: absolute;left:700px;">Cancel</button> 
    </div> 

和我的Ajax調用

$('#cm').blur(function(){ 
    var cmnumber = document.forms['myform']['cm'].value; 
    var modal = document.getElementById('modal'); 
    var shade = document.getElementById('shade'); 

    $.ajax({ 
    type:'get', 
    url: "/validatecm/"+cmnumber, 
    cache:false, 
    async:false, 
    data:cmnumber, 
    success: function(data) { 

      if (data == cmnumber) 
      { alert ("Its a valid CM")} 
      else 
      { var answer = confirm("This is Not a Valid CM. Do you want to File a new one?") 
       if(answer) 
       { 
        modal.style.display=shade.style.display= 'block'; 
       } 
      } 

    }) 

回答

0

您不能堆疊分配(=)這樣在JavaScript:你已經在使用jQuery

modal.style.display=shade.style.display= 'block'; 

,所以使用:

$('#modal, #shade').show()