Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1106 I have a table which is used to present the user with a list of things to do actions on, how can I press a button in the first column and on pressing that, send the user to a new URL and pass with it the contents of the row in the table?

You are here: irt.org | FAQ | JavaScript | Table | Q1106 [ previous next ]

In Internet Explorer 4 you may get the innerText of a tag, but if you want this to be compatible, simply write the table with JavaScript (watch the quotes):

<script language="JavaScript">
Loc = 'http.//www.server.com/cgi-bin/somecgi.pl';

tRow = new Array();
tRow[0] = 'value1';
tRow[1] = 'value2';
tRow[2] = 'value3';
tRow[3] = 'value4';

text = '<form><table>';
for (i=0,n=tRows.length; i<n; i++) {
    text += '<tr>';
    text += '   <td>';
    text += '      <input type="button" value=" '+i+' " onClick="location =\''+ Loc + '?' + tRow[i] + '\';">';
    text += '   </td>';
    text += '   <td>'+tRow[i]+'</td>';
    text += '</tr>';
}
text += '<\/table><\/form>';

document.write(Text);
//--></script>

Feedback on 'Q1106 I have a table which is used to present the user with a list of things to do actions on, how can I press a button in the first column and on pressing that, send the user to a new URL and pass with it the contents of the row in the table?'

©2018 Martin Webb