2016-09-09 6 views
1

私はユーザからパスワードを取得するダイアログボックスを生成したい、ここに少しコードがある。Jquery Dialog does not show

<html> 
<head> 
<script type="text/javascript" src="jquery.min.js"></script> 
<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> 
<script src="http://code.jquery.com/jquery-1.10.2.js"></script> 
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 
</head> 

<body> 
<input type='button' id='btnDelete' name='btnDelete' value='Delete' onclick='deleteRecord(".$row['ID'].")'/> 
<div id="delete-dialog" style="display: none;" title="Delete Record"> 
    <label>Please type in admin's password:</label></br> 
    <input type='password' size='25' id='inpAdminPassword'/>   
</div> 
</body> 
</html> 

JSどういうわけか

function deleteRecord(ID){ 
var answer = confirm("Are you sure you want to delete this record?"); 
if(answer == true){ 
    $("#delete-dialog").dialog("open"); 
    } 
} 

$(document).ready(function() { 
$("#delete-dialog").dialog({ 
    autoOpen: false, 
}); 

、表示されません]ダイアログボックスには、何が欠けている必要がありますか?

私もこのコードを試してみましたが、まだ動作しません。私はちょうどあなたの最初のソリューションをしようと、このような確認が私の作品作っていた

$(document).ready(function() { 
$("#delete-dialog").dialog({ 
    autoOpen: false, 
}); 
$("#delete-dialog").dialog({ 
    modal: true, 
    autoOpen: false, 
    height: 255, 
    width: 300, 
    buttons: { 
     "Delete": function() { 
      var password = document.getElementById('sessionPW').value; 
      var adminpw = document.getElementById('inpAdminPassword').value; 
      alert(password); 
      if(password == adminpw){ 
       window.location = "deleteThreat.php?threatID="+ID; 
      } 
     }, 
     Cancel: function() { 
      $(this).dialog("close"); 
      } 
     } 
    }); 
}); 

答えて

0

JS:

$("#delete-dialog").dialog({ 
     autoOpen: false, 
    }); 

    $("#open").click(function() { 

     if (confirm("are you sure?")) { 
      $("#delete-dialog").dialog("open"); 
     } 


    }); 

HTML:あなたは、CSSコードを

  <div id="delete-dialog" style="display: none;" title="Delete Record"> 
       <label>Please type in admin's password:</label></br> 
       <input type='password' size='25' id='inpAdminPassword'/>   
      </div> 

      <button id="open" >Open</button> 
+0

を入れました?ダイアログはまだ表示されません。準備関数の中にjsコードがありますか? – camille

+0

は準備ができていない機能の中にありません。私はCSSを入れません。 – AitorFDK

+0

まだT.Tを表示していません。jquery-uiバージョンはどうですか? – camille