Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-16-2012, 01:26 PM   PM User | #1
u jayakodi
New Coder

 
Join Date: Sep 2010
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
u jayakodi is an unknown quantity at this point
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
File Type: zip Trace and Edit Cells.zip (636 Bytes, 33 views)
u jayakodi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:25 AM.


Advertisement
Log in to turn off these ads.