Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing, and setting variables equal to html table rows

Status
Not open for further replies.

Nunners

Programmer
Aug 22, 2001
25
GB
Right here goes,

Currently i am developing html and javascript within an Oracle development application called Portal. The Portal currently selects out information from the database, via some new &quot;<ORACLE>&quot; tags, and builds up HTML pages to present to the users.

Within this portal you can obviously create HTML pages and Java Script for your own purposes. Which is what i have done.

At the moment, my page consists of running data along the screen in the form of some snazzy JavaScript. A requirement has arisen to supply the text (for this javascript) from the database. Now, the &quot;ORACLE&quot; tags do not work within java script, only in the HTML. This is not much of a problem as i have created a FORM with hidden fields to pass into the javascript.

My problem is regard to setting these parameters to pass into the Java. The 'clever' &quot;ORACLE&quot; tags actually select out the information from the datbase (great!), but then formats the selected data into an HTML table, rendering my form.record useless. An example of which can be seen below...

<form id=&quot;hiddenOracleForm&quot;>
<input type=&quot;hidden&quot; name=&quot;recordset1&quot; value=&quot;
<TABLE border=&quot;0&quot; cellspacing=0 cellpadding=2>
<TR>
<TH ALIGN=&quot;LEFT&quot; style=&quot;background-color:#C0C0A0&quot;> </TH>
</TR>
<TR style=&quot;background-color: #E0E0D0&quot;>
<TD ALIGN=&quot;LEFT&quot; valign=&quot;TOP&quot; WIDTH=&quot;0&quot;>This is information taken from the portal database</TD>
</TR>
<TR style=&quot;background-color: #E0E0D0&quot;>
<TD ALIGN=&quot;LEFT&quot; valign=&quot;TOP&quot; WIDTH=&quot;0&quot;>This is row two from the table</TD>
</TR>

</TABLE>
&quot;>
</form>


You can see, that my form &quot;hiddenOracleForm&quot;.recordset1.value is actually set to &quot;<-TABLE border=&quot; etc.........When i actually what the two sentences in the table, &quot;This is inform.....&quot; and &quot;This is row two......&quot;

I some how need to set my form attributes to the table rows. Is there anyway of doing this when the number of rows in the table could also vary between one and ten!?!?!?

I hope i have explained myself well enough to warrant an expert responce.

Thanks Nunners
 
Hmmm sounds like a real pain - well you can get the number of rows by using a function like:


function getRows(ObjTable){
var rows = ObjTable.getElementsByTagName(&quot;TR&quot;);
var numberOfRows = rows.length;
return numberOfRows;
}


It takes a table as an argument, though you could modify it to take a string id name.
The variable rows contains an array, where each entry is one of the rows in the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top