jquery对话框问题

时间:2010-12-30 01:48:25

标签: jquery jquery-ui-dialog

当我添加一行来添加对话框时,我的实际页面会消失。谁能告诉我我做错了什么?

 $(function(){          
       //when I open this line, my page disapperars?     
       $("#dialog").dialog({ autoOpen: false,  modal: true  });

   }); /**FUNCTION CLOSED*/

    <div id="dialog" title="Delete Record" style="display: none">
          <p><span style="float:left; margin:0 7px 20px 0;"></span>Are You Sure?</p>
    </div>

2 个答案:

答案 0 :(得分:1)

使用Firebug检查页面的HTML,看看标记是否实际被删除,或者是否被对话框隐藏了。

如果没有真正看到正在发生的事情(并且基于相当小的代码块),通过将对话框声明为模态,jQueryUI可能会设置背景图像或背景颜色,使页面的其余部分看起来像它已被删除。对话框实际出现了吗?

如果您看到任何JavaScript警告,也可以在原始帖子中包含它们。

答案 1 :(得分:0)

试试这个

<html>
<head>
<title>Test</title>
    <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.7.custom.css">
<script type="text/javascript" src="jquery-1.4.4.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.7.custom.min.js"></script>
<script type="text/javascript">

    $(function(){
    //when I open this line, my page disapperars?
    $("#dialog").dialog({ autoOpen: true, modal: true });

    }); /*FUNCTION CLOSED*/

    function openDialog(){
        $( "#dialog" ).dialog({ autoOpen: true, modal: true });
    }
</script>
</head>
<body>
    <p>Para</p>
    <a href="#" onclick="openDialog();">Open Dialog</a>
    <div id="dialog" title="Delete Record" style="display: none">
        <p><span style="float:left; margin:0 7px 20px 0;"></span>Are You Sure?</p>
    </div>
</body>
</html>
相关问题