Javascript jquery对话框在Internet Explorer中加载时不显示CSS样式

Javascript jquery对话框在Internet Explorer中加载时不显示CSS样式,javascript,jquery,Javascript,Jquery,我有一个jQuery对话框,它加载一个外部php页面。除了在Internet Explorer(8)中,所有功能都正常工作。加载对话框时,css会打开然后再次关闭。这意味着对话框是透明的! 当我拖动对话框时,样式将再次应用,并保持应用状态 这是对话框加载方法 <script> $(document).ready(function() { //select all the a tag with name equal to modal

我有一个jQuery对话框,它加载一个外部php页面。除了在Internet Explorer(8)中,所有功能都正常工作。加载对话框时,css会打开然后再次关闭。这意味着对话框是透明的! 当我拖动对话框时,样式将再次应用,并保持应用状态

这是对话框加载方法

<script>
        $(document).ready(function() {

            //select all the a tag with name equal to modal
            $('a[name=eventform]').click(function(e) {
                //Cancel the link behavior
                e.preventDefault();

                $("#dialog").load(e.target.href).dialog({
                    title : 'Activity'
                });

            });

        });
    </script>

$(文档).ready(函数(){
//选择名称等于modal的所有标记
$('a[name=eventform]')。单击(函数(e){
//取消链接行为
e、 预防默认值();
$(“#dialog”).load(e.target.href).dialog({
标题:“活动”
});
});
});
这是外部页面。所有这些在Firefox中都可以正常工作,但在Internet Explorer中加载时,该样式会以某种方式被删除

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title><?php echo $pgtitle ?></title>

    <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.21.js"></script>
    <link rel="stylesheet" type="text/css" href="calendar/css/popwin.css" />


    </head>
<body>
          ......

......
我试图使用@import来获取样式表,但这没有什么区别

同样的问题出现在InternetExplorer9上,但有时也会发生(????)

谢谢,
Coen

尝试将javascript包含在页面底部,就在end body标记之前。这将防止在加载页面之前对DOM进行任何修改

例如:


所容纳之物
...
...
试试这个:

<script>
    $(document).ready(function() {

        //select all the a tag with name equal to modal
        $('a[name=eventform]').click(function(e) {
            //Cancel the link behavior
            e.preventDefault();

            $("#dialog").load(e.target.href, function(){
              $('#dialog').dialog({
                 title : 'Activity'
              })
            });

        });

    });
</script>

$(文档).ready(函数(){
//选择名称等于modal的所有标记
$('a[name=eventform]')。单击(函数(e){
//取消链接行为
e、 预防默认值();
$(“#dialog”).load(e.target.href,function(){
$('#dialog')。dialog({
标题:“活动”
})
});
});
});

尝试将
e.target.href
更改为
this.href
。我相信该对话框的行为不像iframe。你应该把css样式放在你的主page@jSang,这没有什么区别。@可怕的分号样式加载得很好,但在IE中它会忽亮忽灭。当拖动时,样式会再次打开。是的,但如果它不是iframe,则这不是通过ajax加载css的正确方法。所以艾在这个问题上是对的。您需要将样式放在同一页面中,或者使用iframe。事实上,使用iframe更好,因为您还希望运行js库。仅当您调整页面以使用主页时。对话框将结果加载为要添加到主页的html。然后你得到了身体里面的身体=混乱。
<script>
    $(document).ready(function() {

        //select all the a tag with name equal to modal
        $('a[name=eventform]').click(function(e) {
            //Cancel the link behavior
            e.preventDefault();

            $("#dialog").load(e.target.href, function(){
              $('#dialog').dialog({
                 title : 'Activity'
              })
            });

        });

    });
</script>