1
我想生成一個對話框,從用戶獲取密碼,這裏有一點我的代碼。jquery對話框不顯示
<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");
}
}
});
});
你把CSS代碼?對話框仍然不顯示。 js代碼是否在ready函數中? – camille
是不是內部準備好的功能,我不把css – AitorFDK
它仍然不顯示T.T如何jquery-ui版本? – camille