whichIt = event.srcElement;
if (whichIt == null)
alert("whichIt is null");
//下面的语句出现了错误:“对象不支持此属性和方法”
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null)
return true;
}

解决方案 »

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD><BODY>
    <a href=# id = "floater" onmousemove=selectword2()>bbbbbbbbbbbbbbbbbbbb</a>
    </BODY>
    </HTML>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function selectword2()
    {
    var whichIt = window.event.srcElement ;
    if (whichIt == null)
    alert("whichIt is null");
    //下面的语句出现了错误:“对象不支持此属性和方法”
    if (whichIt.id.indexOf("floater") == -1) {
    whichIt2 = whichIt.parentElement;
    if (whichIt2 == null)
    alert("22");
    }
    else
    {
    alert("aaa");
    }
    }//-->
    </SCRIPT>
      

类似问题 »