Spread ASP.NET 6.0 Product Documentation
Finding the Cell Under the Cursor
Send Feedback
Spread ASP.NET 6.0 Product Documentation > Client-Side Scripting Reference > Scripting Overview > Some Simple Uses of Client Scripting > Finding the Cell Under the Cursor

Glossary Item Box

You can use client-side scripting to return which cell the mouse is over in the onmousemove or onmousehover events. This example changes the background color of the cell to red.

JavaScript Copy Code
<script language="javascript">
  function window.onload() {
    FpSpread1.onmousemove = test;
  }

  function test() {
    var col = event.srcElement.cellIndex;
    var row = event.srcElement.parentElement.rowIndex - 1;
    //we have a hidden row used for internal use
    if((!isNaN(col)) && (!isNaN(row)) && (0<=row) && (row<FpSpread1.GetRowCount())) {
      var cell = FpSpread1.GetCellByRowCol(row,col);
      cell.style.backgroundColor = "red";
    }
  }
</script>

Return to the list of Some Simple Uses of Client Scripting.

© 2002-2012 GrapeCity, Inc. All Rights Reserved.