Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1451 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Prototype - Iteration

Thread title: Prototype - Iteration
Closed Thread    
    Thread tools Search this thread Display Modes  
11-28-2007, 12:30 AM
#1
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old  Prototype - Iteration

HTML Code:
<table border="1" style="display: none;" id="table">
	<tr>
		<th>Com</th>
		<th>Net</th>
		<th>Org</th>
		<th>Us</th>
		<th>Biz</th>
		<th>Info</th>
		<th>Co.uk</th>
		<th>Org.uk</th>
		<th>Tv</th>
		<th>In</th>
	</tr>
	<tr>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
</table>
I have one table, two table rows. The first table row consists table headers and the second one WILL contain table data (currently they are blank).

I want to update the second table row, table data from an array.

It's an JSON array generated through Ajax query.

It is certainly not a good way to add id to each td and then update each table data with each line of code.

I'm thinking about iterating the query (like foreach query from PHP) via JSON array and updating the table data. First thing I need to do is to select the second table row from the table, then update the table data.

I'm not sure how to do it since I'm a beginner in javascript.

P.S: Using Prototype

11-28-2007, 12:47 AM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

I don't want to sound rude or unhelpful at all but please read the available documentation and there are lots of readily available examples both there and elsewhere on the 'net for achieving simple tasks like this. After reading the docs, feel free to ask again.

11-28-2007, 12:51 AM
#3
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

I did searched through documentation to find a relevant function and didn't found it until I looked again.

I found the function now and will give it a whirl.

Thanks

P.S: http://prototypejs.org/api/enumerable/each

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed