473,513 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get value from element

77 New Member
i have this script...

Expand|Select|Wrap|Line Numbers
  1.             var td = document.createElement('td');
  2.             var p = document.createElement('p');
  3.             var label = document.createElement('label');
  4.             var span = document.createElement('span');
  5.             var theData = document.createTextNode(pbdcuraian);
  6.             var theTextarea = document.createElement('textarea');
  7.             theTextarea.setAttribute('name', 'items['+item_count+'][work_description]');
  8.             theTextarea.setAttribute('id', 'items['+item_count+'][work_description]');
  9.             theTextarea.setAttribute('rows', '2');
  10.             theTextarea.setAttribute('cols', '25');
  11.             label.appendChild(span);
  12.             theTextarea.appendChild(theData);
  13.             label.appendChild(theTextarea);
  14.             p.appendChild(label);
  15.             td.appendChild(p);
  16.             row.appendChild(td);
  17.  
  18.             var td = document.createElement('td');
  19.             var p = document.createElement('p');
  20.             var label = document.createElement('label');
  21.             var span = document.createElement('span');
  22.             var theData = document.createTextNode('Location');
  23.             var theInput = document.createElement('input');
  24.             theInput.setAttribute('type', 'text');
  25.             theInput.setAttribute('name', 'items['+item_count+'][pbdckdlok]');
  26.             theInput.setAttribute('size', '3');        
  27.             theInput.setAttribute('value',pbdckdlok);
  28.             span.appendChild(theData);
  29.             label.appendChild(span);
  30.             label.appendChild(theInput);
  31.             p.appendChild(label);            
  32.             td.appendChild(p);
  33.             row.appendChild(td);
  34.  
actually i have one element textarea and five element input (the script only show for one creation of element input).

I want to get a value from those element, how can i get those value of elements, any idea??
Jul 23 '08 #1
3 1597
Brosert
57 New Member
You need to access the value element of the object
Expand|Select|Wrap|Line Numbers
  1. theTextArea.value
  2.  
Jul 23 '08 #2
maminx
77 New Member
You need to access the value element of the object
Expand|Select|Wrap|Line Numbers
  1. theTextArea.value
  2.  

yes of course, i know i can get the value with that script or this.getAttribute('value')...

but that's only works for one element input, and you know as i said i have 5 elements input...

idea??
Jul 23 '08 #3
gits
5,390 Recognized Expert Moderator Expert
just get the list of input-elements with:

Expand|Select|Wrap|Line Numbers
  1. var list = document.getElementsByTagName('input'); 
  2.  
loop through the list and store the values the way you want ... you could even store the ids of the created nodes during the creation process and then loop over this ids and retrieve the values with:

Expand|Select|Wrap|Line Numbers
  1. var a = [];
  2.  
  3. for (var i = 0, n; n = id_list[i]; i++) {
  4.     a.push(document.getElementById(n).value);
  5. }
in this case a would have all values that correspond to the nodes with the stored ids in the list

kind regards
Jul 23 '08 #4

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

Similar topics

5
14915
by: Derek Cooper | last post by:
I hope you can help me. I posted this in the microsoft sql server newsgroup a few days ago and got no response so I thought I'd try here. If I can provide any clarification I'll be glad to do so....
0
1473
by: Ingrid | last post by:
Am I right in thinking that datatyping at element level ie <xs:element name="num" type="xs:integer"> and specifying a choice of attribute values ie <xs:attribute name="kind"> <xs:simpleType>...
21
3931
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
3
13522
by: Lynn | last post by:
Hi all, I am having problem when did the validation of XML document with Schema. my schema is like the following: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="schema.xsd"...
1
2201
by: Maksim | last post by:
Trying to find out a way how to restrict value of the element by name of an element, it might be not even possible, but anyhow. Let's consider following snippet: <xs:element name="tag1"...
1
1456
by: Paul Cheevers | last post by:
Hi, I've been trying to write some schema to validate the Value element of an Eq element but to no avail. If the Value Element is off type DateTime then the node should be able to contain text...
13
10088
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
8
1873
by: patrizio.trinchini | last post by:
Hi All, I'would like to write an XSL transformation that changes the value of the atribute of a given element according to the value of another atttribute of the same element. For instance,...
3
2736
by: patrizio.trinchini | last post by:
Hi, how can remove sibling elements based on the value of an attribute ? For instance, gven the XML document: <root> <parentElment> <testElement name="A"> <removableElement/>
2
2546
by: Bilal | last post by:
Hello, I'm stuck on this problem for quite some time and hope somebody would be able to guide me. Basically, I need to populate a large number of "template" XML files which have all...
0
7259
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
7158
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
7535
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
7098
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
7523
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
5683
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,...
0
3232
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
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.