其中text_edit.htm中含有对<iframe>进行各种编辑的脚本

解决方案 »

  1.   

    你这个问题其实是可以解决的..
    关键是在于你并没有理解DHTML Scriptlet
    技术的使用方式.
    在你的text_edit.htm页中应该通过script暴露一系列的方法和属性供宿主文件使用. 
    下面是我在MSDN中找到的关于这种技术的描述..
    当然你所使用的这种HTML编辑器我并不推荐,因为用iframe来实现更简单
    Designing a Scriptlet --------------------------------------------------------------------------------A scriptlet is simply a Dynamic HTML (DHTML) page that uses certain conventions to define its properties, methods, and events. To define the page as a scriptlet:
    Create a Microsoft&reg; JScript&reg; public_description object to manage properties and methods. With this convention, you explicitly define which properties and methods the scriptlet will make available. Any behavior that is not explicitly declared using the public_description object is not available. For more information, see Creating a public_description Object.
    Or, use a default interface description. You do not explicitly declare properties or methods. Instead, any variables and functions that follow certain naming conventions become available as properties and methods. You can use this method if you want to create scriptlet properties and methods in an active scripting language other than JScript. For more information, see Using Default Interface Descriptions. 
    Using a public_description object has several advantages. You can use any names for variables and functions that you want to expose as properties and methods because you assign them public names in the public_description object. In addition, using the public_description object provides you with a convenient way to summarize and document the properties and methods that the scriptlet exposes. In contrast, if you use the default interface descriptions, you must use the public_ prefix on any name that you want to expose. If a scriptlet already happens to have a variable or function with the public_ prefix, it will always be exposed, whether you want it to be or not. When you create the properties, methods, and events for the scriptlet, you can make full use of the DHTML Object Model to display text, animate HTML elements, change colors, or define any other behavior that you want the control to have. You can also use extensions to the DHTML Object Model that are available as part of the external object, which is unique to scriptlets. For a summary of the extensions, see Scriptlet Model Extensions. Note  You can determine from within the .htm file whether it is being used as a scriptlet or simply as a standalone Web page. For details, see the version  property. 
      

  2.   

    1.text_edit.htm添加代码如下
    <iframe name="target" style="WIDTH: 90%; border:1 #000000 solid;HEIGHT: 80%" tabindex=4 border=0 frameborder=0>
       </iframe> 
    <br>
    </div>
    </body>
    <script >
    targetDoc = document.frames.target.document;
    targetDoc.designMode = "On";
    target.focus();public_description=new Editorfunction Editor()
    {
      this.put_html=function(v){target.document.body.innerHTML=v};
      this.get_html=function(){return target.document.body.innerHTML};
      this.put_text=function(v){target.document.body.innerText=v};
      this.get_text=function(){return target.document.body.innerText};
    }
    </script>2.text.html就可以调用html和text了
    <object id="mess" name="mess"  data="text_edit.htm"  width="100%" height="90%" type="text/x-scriptlet" ></object>
    <input type=button onclick=alert(document.all.mess.html) value=html>
    <input type=button onclick=alert(document.all.mess.text) value=text>