toElement是onmouseout,onmouseover的一个信息,
告诉你鼠标移动去哪里了。

解决方案 »

  1.   

    贴原文给你srcElement Property-------------------------------------------------Retrieves the object that fired the event. SyntaxHTML N/A 
    Scripting [ oObject = ] event.srcElement  Possible ValuesoObject Object that specifies the event that fired. The property is read-only with no default value.ExampleThis example uses the srcElement property to retrieve the parent object, if needed, create the text range, move to the original object, and select the first word in the object.Sample Code<SCRIPT LANGUAGE="JScript">
    function selectWord() {
        var oSource = window.event.srcElement ;
        if (!oSource.isTextEdit) 
            oSource = window.event.srcElement.parentTextEdit;
        if (oSource != null) {
            var oTextRange = oSource.createTextRange();
            oTextRange.moveToElementText(window.event.srcElement);
            oTextRange.collapse();
            oTextRange.expand("word");
            oTextRange.select();
        }
    }
    </SCRIPT>
    toElement Property-------------------------------------------------Retrieves a reference to the object to which the user is moving the mouse pointer.SyntaxHTML N/A 
    Scripting [ oObject = ] event.toElement  Possible ValuesoObject Object that specifies the object being moved to by the mouse. The property is read-only with no default value. ExampleThis example uses the toElement property to display the tagName of the object to which the user moves the mouse pointer.Sample Code<SCRIPT>
    function fnGetTo(){
       spanTo.innerHTML=window.event.toElement.tagName;
    }</SCRIPT>
    :
    <SPAN onmouseout="fnGetTo()">
       <P>Mouse Over This</P>
       <P>toElement: <SPAN ID="spanTo"></SPAN></P>
    </SPAN>fromElement Property
    -------------------------------------------------Retrieves the object the mouse pointer is exiting during the onmouseover and onmouseout events. SyntaxHTML N/A 
    Scripting [ oObject = ] event.fromElement Possible ValuesoObject Object that specifies the previous location of the mouse pointer. The property is read-only with no default value. ExampleIn this example, the alert returns "mouse arrived" when the mouse pointer moves over the button.Sample Code<SCRIPT>
    function testMouse(oObject) {
    if(!oObject.contains(event.fromElement)) {
    alert("mouse arrived");
    }
    }
    </SCRIPT>
    :
    <BUTTON ID=oButton onmouseover="testMouse(this)">Mouse Over This.</BUTTON>