【发布时间】:2013-12-06 14:52:43
【问题描述】:
我的代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="http://localhost/abc/pqr/web/css_new/style.css" rel="stylesheet" type="text/css" />
<link href="http://localhost/abc/pqr/web/css_new/scroll.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://localhost/abc/pqr/web/css/jquery_ui/ui.all.css" type="text/css" />
<script type="text/javascript" src="http://localhost/abc/pqr/web/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://localhost/abc/pqr/web/js/jquery_ui/ui.core.js"></script>
<script type="text/javascript" src="http://localhost/abc/pqr/web/js/jquery_ui/ui.dialog.js"></script>
<script>
var timer;
var keys = {};
$(document).ready(function () {
$(document).mouseleave(function () {
customAlert("Your mouse is away");
});
});
$(document).keydown(function (e) {
keys[e.which] = true;
});
$(document).keyup(function (e) {
delete keys[e.which];
});
if( (keys[91] && keys[68]) || (keys[18] && keys[9]) || (keys[17] && keys[91] && keys[68]) ) {
customAlert("Your mouse is away");
}
function customAlert(customText) {
$("#popUp").html(customText);
timer = setInterval(customAlert2, 5000);
$("#popUp").dialog({
dialogClass: "no-close",
buttons: [{
text: "OK", click: function () {
$(this).dialog("close");
clearInterval(timer);
}
}]
});
}
function customAlert2() {
location.reload();
$("#popUp2").dialog({
dialogClass: "no-close",
buttons: [{
text: "OK", click: function () {
$(this).dialog("close");
}
}]
});
}
</script>
</head>
<body>
<h1>My first PHP program</h1>
<p>Hello World!</p>
<div id="popUp" title="First alert message"></div>
<div id="popUp2" title="Second alert message">Time is over</div>
</body>
</html>
当显示弹出窗口时,确定按钮丢失。它只显示'O'。你能在这方面帮助我吗?我还附上了弹出窗口的屏幕截图。请查看它以更好地了解我的问题。
【问题讨论】:
-
您的第一个 PHP 程序中没有 PHP!哈哈。 :)
标签: javascript jquery jquery-ui jquery-ui-dialog alert