正如標題所述,我在javascript中遇到了一個奇怪的錯誤。 在我的PHP我呼應了JavaScript呈現jquery彈出警告框到屏幕。自定義警報在JQuery UI中不起作用
echo '<link rel="stylesheet"
href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script src="../functions.js"></script>
<script type="text/javascript"> JQueryAlert("HELLO!", 120);</script>';
functions.js
function JQueryAlert(message,windowHeight){
if (!windowHeight) var windowHeight = 470;
$("#msgdialog").remove();
$("body").append("<div id=\'msgdialog\'></div>");
thatmsg = $("#msgdialog");
$("#msgdialog").dialog({
resizable: false,
draggable: false,
width: 770,
height: windowHeight,
context: thatmsg,
modal: true,
autoOpen: false,
buttons: {
"Cancel" : function(){
thatmsg.dialog("close");
},
"OK" : function(){
loadPage("combat.php");
}
}
});
$("#msgdialog").html(message);
$("#msgdialog").dialog(\'open\');
}
然而,只顯示彈出警告框有時。剩下的時間屏幕閃爍並且不顯示彈出框。任何想法,爲什麼這樣表現?謝謝你的時間。
http://phpfiddle.org/ - 一個活生生的例子會更容易identift問題 – Ryan
控制檯應該告訴你的故事.. F12 now .. – techfoobar
任何相關的控制檯輸出? – Sirko