English 中文(简体)
提纲:设计 frame frame dia dia与FF合作的方式
原标题:Javascript: designMode for iframe doesn t work with FF when in jQuery dialog

这里的样本代码(干活——仅复制一份空洞的html文档,并将工作):

<html>
<head>
<title></title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<script type="text/javascript" language="javascript">
    function Init()
    {
        var doc = document.getElementById("iView").contentWindow.document;

        doc.designMode = "On"

        doc.open()
        doc.write("<html><head></head><body class= some-class >Some test text</body></html>");
        doc.close();
    }
</script>
</head>
<body>

<div id="dlgDiv" style="width:202px; height:72px; border: solid 1px grey">
    <iframe id="iView" style="width: 200px; height:70px" frameborder="0"></iframe>
</div>

<script type="text/javascript">

    var dlg = null;
    jQuery(document).ready(function() {

        Init();

        dlg = jQuery("#dlgDiv").dialog({
            autoOpen: false,
            bgiframe: true,
            modal: true,
            width: 400
        })

        dlg.dialog( open );
    })

</script>
</body>
</html>

Now, when I run this in IE, I can edit contents of iframe; also using IE Developer Toolbar I can see that body of iframe preserves class "some-class" I specified. But, when running this in FF, iframe is not editable, and when inspecting its DOM with firebug, i see that iframe s body is empty and has no class. So looks like for FF dialog makes a shallow copy of the div instead of using the div itself (dlgDiv) for dialog, or something like that...

从根本上说,这意味着设在贾布特的丰富文本编辑的NONE将在FF(和btw 谷歌之明)的支气中工作——这是一个严重的坏问题(我迄今为止已经尝试过两个问题,我是如何开始研究这一问题的)!

对我如何处理这一问题的任何想法/看法/建议,都受到高度赞赏!

Thank you, Andrey

最佳回答

排 定 的

var dlg = null;
jQuery(document).ready(function() {



    dlg = jQuery("#dlgDiv").dialog({
            autoOpen: false,
            bgiframe: true,
            modal: true,
            width: 400
    })

    dlg.dialog( open );

    Init();
})
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签