从 scrollTop 到 clientHeight+scrollTop 当前显示的纵坐标范围

解决方案 »

  1.   

    谢谢小康。var row =document.getElementById("firstRow");
    row.style.position="absolute";
    if((row.*** >document.body.scrollTop)&&
     (row.***<document.body.clientHeight+document.body.scrollTop))
    { row 可见。
    }我想知道这个row.***到底应该是tr的什么属性。谢谢。
      

  2.   

    row.scrollTop的值始终都是0,没有变化。奇怪。
      

  3.   

    下面是页面的源程序,请高手帮忙调试一下。谢谢。
    <html>
    <script type="text/javascript">
    <!--
    window.onscroll=do_scroll;
    function do_scroll(){
      canView();
     
    }function canView(){    var row =document.getElementById("firstRow");
        row.style.position="absolute";
        
        if((row.scrollTop >document.body.scrollTop)&&
        (row.scrollTop<document.body.clientHeight+document.body.scrollTop))
        {
        
         alert("ok"+row.scrollTop);
        
        
        }else{
        alert("no"+row.scrollTop);
        }}
    //-->
    </script>
    <body >
    <br>
    <br>
    <br>
    <br>
    <input type ="text" name ="t" id="t"/>
    <table border="1" id="tb" cellpadding="2" cellspacing="0">
      <tr id = "firstRow" bgColor="red">
        <th>
          name
        </th>
        <th>
          value
        </th>
        <th>
          meaning
        </th>
      </tr>
      <tr>
        <th>
          <code>
            src
          </code>
        </th>
        <td>
          <code>
            "
          </code>
          <var>
            URL
          </var>
          <code>
            "
          </code>
        </td>
        <td>
          the address of the initial content for the inline frame
        </td>
      </tr>
      <tr>
        <th>
          <code>
            name
          </code>
        </th>
        <td>
          <code>
            "
          </code>
          <var>
            string
          </var>
          <code>
            "
          </code>
        </td>
        <td>
          assigns a name to the inline frame, for 
          <a href="#target">        use in
            <code>
              target
            </code>
            attribute</a>
        </td>
      </tr>
      <tr>
        <th>
          <code>
            longdesc
          </code>
        </th>
        <td>
          <code>
            "
          </code>
          <var>
            URL
          </var>
          <code>
            "
          </code>
        </td>
        <td>      refers to a document containing a description (not supported yet)
        </td>
      </tr>
      <tr>
        <th>
          <code>
            width
          </code>
        </th>
        <td rowspan="2">
          number of pixels or percentage (e.g. 
          <code>
            "20%"
          </code>      )
        </td>
        <td>
          width of the inline frame; see 
          <a href="#dim" title="Dimensions">        notes below</a>
        </td>
      </tr>
      <tr>
        <th>
          <code>
            height
          </code>
        </th>
        <td>
          height of the inline frame; see 
          <a href="#dim" title="Dimensions">        notes below</a>
        </td>
      </tr>
      <tr>
        <th rowspan="5">
          <code>
            align
          </code>
        </th>
        <td>
          <code>
            "top"
          </code>
        </td>
        <td>      aligns the inline frame vertically on the top of the surrounding
          content on its left and right
        </td>
      </tr>
      <tr>
        <td>
          <code>
            "bottom"
          </code>
        </td>
        <td>      aligns the inline frame vertically on the bottom of the
          surrounding content on its left and right
        </td>
      </tr>
      <tr>
        <td>
          <code>
            "middle"
          </code>
        </td>
        <td>      aligns the center of the inline frame vertically with the current
          baseline
        </td>
      </tr>
      <tr>
        <td>
          <code>
            "left"
          </code>
        </td>
      

  4.   

    <td>      places the inline frame at the left margin so that subsequent
          page content flows on the right of it
        </td>
      </tr>
      <tr>
        <td>
          <code>
            "right"
          </code>
        </td>
        <td>      places the inline frame at the right margin so that subsequent
          page content flows on the left of it
        </td>