<iframe name="demo"></iframe>
<script language="JavaScript">
<!--
demo.document.designMode="on"
demo.document.onclick=a
function a(){
alert('hello')
}
//-->
</script>

解决方案 »

  1.   

    楼主说的可能是框架中的文档元素..那个是不能响应onclick(应该说是任何事件)事件的..不过通过document.onselectionchange结合textRange对象你还是可以操作文档元素的onselectionchange Event--------------------------------------------------------------------------------This documentation represents a snapshot taken for a product in the final release phase (release candidate).
    Fires whenever the selection state of a document changes. SyntaxEvent property document.onselectionchange = handler Microsoft?JScript?(compatible with ECMA 262 language specification) only 
    document.onselectionchange = GetRef("handler") Microsoft?Visual Basic?Scripting Edition (VBScript) 5.0 or later only 
    Named script <SCRIPT FOR = document EVENT = onselectionchange>  Internet Explorer only Event Object InformationBubbles No 
    Cancels No 
    To invoke Cause the selection object's type property to change. 
    Return a range from a different location when using the createRange method of the selection object. 
    Move the insertion point in an editable region of the document using the mouse or keyboard. 
    Start or extend a text selection by dragging the mouse or using SHIFT+an arrow key. 
    Make a control selection in an editable region of the document.
    Add or remove an element from a multiple selection by pressing SHIFT while clicking on the element. 
    Delete text or an element in an editable region of the document by using the BACKSPACE key or DELETE key or CTRL+X or the Delete command.
    Insert text or an element in an editable region of the document by using CTRL+V or the Paste command.
     
      

  2.   

    这个为什么不响应??
    <iframe name="demo"></iframe>
    <script language="JavaScript">
    <!--
    demo.document.designMode="on"
    demo.document.ondblclick=a
    function a(){
    alert()
    alert(event.srcElement.outerHTML)??
    alert(edit.document.selection.createRange()(0).tagName)??
    }
    //-->
    </script>
      

  3.   

    那document.onselectionchange怎么实现
    在编辑的时候,点按纽时响应事件???这个为什么不响应??
    <iframe name="demo"></iframe>
    <script language="JavaScript">
    <!--
    demo.document.designMode="on"
    demo.document.ondblclick=a
    function a(){
    alert()
    alert(event.srcElement.outerHTML)??
    alert(edit.document.selection.createRange()(0).tagName)??
    }
    //-->
    </script>
      

  4.   

    function a(){
    demo.document.execCommand("InsertInputButton")
    alert(demo.event.srcElement.outerHTML)
    alert(demo.event.srcElement.tagName)
    }