473,486 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

to save values in an array form a table that is dynamically generated

syedshaffee
91 New Member
i have made a table in asp classic that generates values dynamically.Written a jQuery for retrieving the values from this table by clicking on a checkbox & displaying it in a msgbox i want to save it in an array assuming the customer will select more than one row
Expand|Select|Wrap|Line Numbers
  1.  $(document).ready(function () {    
  2.     //assigning alternative row style
  3. $("#Table_Data tr:even").addClass("evenrow");
  4. $("#Table_Data tr:odd").addClass("oddrow");
  5.  
  6.  $("#Table_Data tr").click(function(){
  7.    $(this).find(':checkbox').attr('checked', ! $(this).find(':checkbox').attr('checked'));    
  8.    if($(this).find(':checkbox').attr('checked'))
  9.         {
  10.               var html = '';
  11. $(' #Table_Data td').click(function() {
  12.     html = $(this).text();
  13.     alert(html);
  14.  
  15. });
  16.  
  17.         }
  18.         else
  19.         {
  20.             $(this).removeClass('highlight');
  21.               $(this).addClass('evenrow');
  22.         }
  23. });
My problem is:
1)array size
2)only once the value should be save in an array
3)The back ground of the row doesn't change
Jan 20 '12 #1
2 1514
limweizhong
62 New Member
1. Use [Array].length if you want the length of an array.
2. Don't use arrays then. Use associative arrays (which all objects are) and ids:
Expand|Select|Wrap|Line Numbers
  1. r={};
  2. r.length=0;
  3. function clickon(id){ r[id]=1; r.length++; }
  4. function clickoff(id){ delete r[id]; r.length--; }
  5. function printr(r){ var o=""; for(var a in r){ o+=a+","; } o=o.slice(0,-1); return o; }
  6.  
3. I totally don't get this.
Jan 26 '12 #2
syedshaffee
91 New Member
ok i will try this thanks for the reply
Jan 26 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2302
by: rufus | last post by:
I am created a table dynamically and I have wrapped it in a div tag so that the user can scroll the table horizontally ie I have added an overflow property to the div. I dont want the user to be...
0
2520
by: Boris | last post by:
When I dynamically create CheckButtonList, I add ListItem(s) to my CheckButtonList object chkList chkList.Items.Add(new ListItem("My Text", "My Value")); The resulting HTML doesn't contain...
2
4880
by: ghadley_00 | last post by:
Hi, I have a database with a main table and a lookup table of customers, and reports for each of the customers listing each transaction they have listed. I have a form that has buttons for...
0
1005
by: ILCSP | last post by:
Hello, I am trying to create a form in Visual Basic.Net with a dynamically created Menu bar. I need the drop down part of a menu item (Reports) to be dynamically generated according to the...
1
2235
verbatim
by: verbatim | last post by:
with the following page, the dynamically generated fields are not recognized when i try to submit the form, or add more elements. when i hit my submit button, the address bar has only x1 - x5 in...
7
2529
by: Srikanth Ram | last post by:
Hi, I'm creating a PHP application. In this a dynamic table with the fields in the database is generated in a page. I have placed a checkbox in each row of the table to approve/disapprove...
3
1701
by: MitchellEr | last post by:
Hi, I am in the process of creating several forms where a group of elements on the form need to be created dynamically. For example, in the case of one of the forms, I have a drop down for...
2
3302
by: mylog | last post by:
Hi I am having a problem of getting the value from the dynamically generated table and dropdownlist. What I am facing is, I have created a table in the aspx page and now I need to add values to...
9
2761
by: student4lifer | last post by:
Hello, could someone show me how to make sticky form with dynamically generated form element? for example, if one likes to make the dynamically generated check box (and its name) 'sticky' that...
1
3927
by: ramel | last post by:
Hi all, I have a problem related to javascript , ajax and jsp. Please see this url http://xil.co.in/print_screen_2.JPG. I am working on this form. There are some buttons (like submit ,...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5427
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.