Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tracing Cells and Editing contents

    This tiny utilty displays the cell row and column numbers when the mouse is moved over it; click on a cell to edit its contents. No problem with multiple tables in a page.

    Just add the two script blocks to the page containing tables; the program uses the TITLE property to display the address. No code is needed for the cells nor the cumbersome routine to detect a table or cell; the event for the document is made to respond at a lower order TD tag of the cell and its relation to the parent row completes the task.

    code:
    Code:
    <script for=document event=onmouseover>
    var ele=event.srcElement;if(ele.tagName=="TD"){ele.title="Row = "+ele.parentNode.rowIndex.toString()+"; Col = "+ele.cellIndex.toString()}
    </script>
    <script for=document event=onclick>
    var ele=event.srcElement;if(ele.tagName=="TD"){rn=ele.parentNode.rowIndex;cn=ele.cellIndex
    ele.parentElement.cells(cn).innerText=window.prompt("",ele.innerText)}
    </script>
    A test page with two tables test.htm is in the zip file.

    jayakodiu@yahoo.com
    Attached Files Attached Files


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •