jQuery ui 对话框在页面刷新时消失?
我有一个基本对话框,在用户单击按钮之前应始终显示该对话框。问题是,当我手动刷新页面后,它消失了,但如果我再次刷新它,它又重新出现。我应该如何解决这个问题,以便它在第一次刷新后不会消失?
样本:
<?php
$mysql = mysql_query("SELECT tut FROM users WHERE username='$session_username'");
while ($tutno = mysql_fetch_assoc($mysql)) {
$tut = $tutno["tut"];
}
if ($tut == 0)
{
?>
<html><body>
<script type="text/javascript" src="http://sciencewar.hostme.lt/jquery/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://sciencewar.hostme.lt/jquery/js/jquery-ui-1.8.9.custom.min.js"></script>
<script>
$(function() {
$( "#tut" ).dialog(
{
draggable: false,
resizable: false
});
});
</script>
<div id="tut" title="Basic dialog">
<p>Example.</p>
</div>
</body></html>
<?
}
?>
I've got a basic dialog which should be always shown until the user clicks a button. The problem is that after I refresh the page manually it disappears, but if I refresh it again it reappears. How should I fix that so that it wouldn't disappear after the 1st refresh?
Sample:
<?php
$mysql = mysql_query("SELECT tut FROM users WHERE username='$session_username'");
while ($tutno = mysql_fetch_assoc($mysql)) {
$tut = $tutno["tut"];
}
if ($tut == 0)
{
?>
<html><body>
<script type="text/javascript" src="http://sciencewar.hostme.lt/jquery/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://sciencewar.hostme.lt/jquery/js/jquery-ui-1.8.9.custom.min.js"></script>
<script>
$(function() {
$( "#tut" ).dialog(
{
draggable: false,
resizable: false
});
});
</script>
<div id="tut" title="Basic dialog">
<p>Example.</p>
</div>
</body></html>
<?
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您的 javascript 是正确的,我只能假设问题是一致
的。您能否验证您的 javascript 是否在页面上呈现?
您还可以删除
if
语句并检查该对话框是否始终出现。Since your javascript is correct I can only assume that the problem is in
line. Could you verify if your javascript is rendered at all on the page?
You can also remove the
if
statement and check if the dialog appears at all times.