你试一下这个或许就明白了for(var i in sValue4)
{
    alert(i);
}

解决方案 »

  1.   

    var sValue4 = oTR1.cells[0].firstChild;
    for(var i in sValue4)
    {
        alert(i);
    }
      

  2.   

    没有该属性...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <!-- DW6 -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>shawl.qiu template</title>
    <style type="text/css">
    /* <![CDATA[ *//* ]]> */
    </style>
    <script type="text/javascript">
    //<![CDATA[
    if (navigator.appName=="Microsoft Internet Explorer") {
    //最大化窗口
    self.moveTo(-5,-5)
    self.resizeTo(screen.availWidth +8,screen.availHeight+8)
    //这个脚本定义的宽度其实比原窗口还要大那么一点.
    }
    //]]>
    </script>
    <script type="text/javascript">
    //<![CDATA[
     function fListMtd(obj, e){
      if(!e)var e=window.event;
      var sur=e.srcElement||e.target;
      try{w.close();}catch(e){}
       w=open('','newwin','width=500,height=500,left=300,top=100,scrollbars');
       w.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
       w.document.write('<style>body{width:400px;word-w.document.writeap: break-word;}</style>');
       w.focus;
       w.document.ondblclick=function(){w.close();}
       fListMtd(obj, w);
       w.onload=function(){ w.document.title=sur.firstChild.data;};
       w.document.close();
      return true;
      function fListMtd(obj, target){
       var ar=new Array();
       var j=0;
       
       for(var i in obj){
        try{
         ar[j]=i.bold()+' '+(typeof obj[i]).fontcolor('red')+
         ' '+(obj[i]+'').fontcolor('blue');
         j++;
        }catch(e){
         ar[j]=i.bold()+' '+(typeof obj[i]).fontcolor('red')+
         (' empty').fontcolor('red').bold()
         j++;
        }
       }
       ar=ar.sort();
       for(var i=0; i<ar.length; i++){
        target.document.write(i+1,'. ',ar[i],'<br/>');
       }
       return true;
      }
     } // end function fListMtd

    onload = 
     function()
    {
     fListMtd(document.getElementById('a').firstChild, event);
    }
    //]]>
    </script>
    </head>
    <body>
    <div id="a">aaa</div>
    </body>
    </html>
      

  3.   

    楼上讲的小弟不是很明白,是不是firstChild后面只能有nodeValue不能跟innerText?谢谢
      

  4.   


    var sValue4 = oTR1.cells[0].firstChild;
    for(var i in sValue4)
    {
        alert(i);
    }
    可以看出没有innerText这个属性,也就是说你得到的这个firstChild已经不是一个XML/HTML Element
      

  5.   

    <!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>
    <script language="javascript" type="text/javascript"> 
    function getValue()


       alert(document.all.HYSBH.parentNode.parentNode.parentNode.lastChild.nodeValue); 
       alert(document.all.HYSBH.parentNode.parentNode.parentNode.lastChild.innerText); 

    </script> <table>
            <tr bgcolor="#ffffff">
                <td> <p><input type="radio"  name="HYSBH" id="HYSBH" onclick="getValue();"/> </p><input type="text" name="projName" value="yy" ></td>
                <td id="p1"><p>2222</p></td>
                <td id="p2">3333</td>
                <td >4444</td>
            </tr>
            <tr>
             <td>okk</td>
            </tr>
     </table>
     </BODY>
    </HTML>但在这里
     alert(document.all.HYSBH.parentNode.parentNode.parentNode.lastChild.nodeValue); 为null
     alert(document.all.HYSBH.parentNode.parentNode.parentNode.lastChild.innerText);有值 
    第一为空第2个有值是怎么回事啊,这里有nodeValue属性
      

  6.   

    晕, 你用点书啃啃书吧...nodeType 不同, 属性也不会相同....