TBor
05-27-2003, 12:48 PM
Howdy all. This is a "kinda ASP / kinda VBScript" question, but hopefully someone here can help me out. I've done this before, but just plain forget how.
I've got an ASP page that's reading values from a DB and displaying them in a table. Each row of the table has its own id (the primary key from the DB). There are 4 columns in my table, and each of the <td> tags gets a unique name/id based on the row ID (the id/names are "desc8", targ8" etc. for the <td> tags in row 8, for example).
What I want to do is, on single event in a row, read the innerText of all <td> tags in that row (i.e. click on a button in row 8, retrieve all the innerText from the table cells in row 8). The event passes the row ID to my client-side subroutine, and I create variables with the respective <td> id/names. (i.e. descID = "desc" + rowID"
Now, the big question: how do I get the innerText using the variable contents, not the variable name?
For example: document.form.desc8.innerHTML will get me the text I want from row 8. However, if the string "desc8" is stored in variable descID, I'm stuck. I thought it was something like document.form.item(descID).innerText, or document.form.value(descID).innerText, but those don't seem to work.
Any help would be greatly appreciated.
Thanks,
TBor
Here's what my code (partially) looks like:
sub Click(rowID)
descID = "desc" & rowID
targID = "targ" & rowID
...
descText = document.form.?????.innerText
targText = document.form.?????.innerText
end sub
I've got an ASP page that's reading values from a DB and displaying them in a table. Each row of the table has its own id (the primary key from the DB). There are 4 columns in my table, and each of the <td> tags gets a unique name/id based on the row ID (the id/names are "desc8", targ8" etc. for the <td> tags in row 8, for example).
What I want to do is, on single event in a row, read the innerText of all <td> tags in that row (i.e. click on a button in row 8, retrieve all the innerText from the table cells in row 8). The event passes the row ID to my client-side subroutine, and I create variables with the respective <td> id/names. (i.e. descID = "desc" + rowID"
Now, the big question: how do I get the innerText using the variable contents, not the variable name?
For example: document.form.desc8.innerHTML will get me the text I want from row 8. However, if the string "desc8" is stored in variable descID, I'm stuck. I thought it was something like document.form.item(descID).innerText, or document.form.value(descID).innerText, but those don't seem to work.
Any help would be greatly appreciated.
Thanks,
TBor
Here's what my code (partially) looks like:
sub Click(rowID)
descID = "desc" & rowID
targID = "targ" & rowID
...
descText = document.form.?????.innerText
targText = document.form.?????.innerText
end sub