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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Tables and JavaScript help

Status
Not open for further replies.

amies

Programmer
Feb 11, 2009
1
GB
I was wondering if anyone could help me with this:

I have a list of quotes held in a data table and they are accessed randomly every time a page loads through a template containing JavaScript. I am currently reading the rows with a switch statement:

switch(selectedQuote) {
case 1:
quote = stripTNR("<!wem record=0 datafield.0 HTMLSTRING>");
break;

The data table is growing rapidly and so is the switch statement so I was wondering if there was any way I could replace the <!wem > statement with something like:

quote = stripTNR("<!wem record=/""+selectedQuote+"/" datafield.0 HTMLSTRING>");

The above code currently just returns the 1st line of the data table only.

If this is not possible is there any other way of randomly selecting a row fro the data table?

Thanks,

Amy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top