473,395 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

get all value of all row of a dynamic html table

I have create a dynamic html table by adding some rows where I have to put
some value in an input field and now how can I get all value of all row ???

I try this but it doesn' work
button onclik=Alert("EditFieldValue2.value");

Please reply me as soon as possible.

<script>
function addRowToTable()
{
var FieldArray=new Array("ID","CodiceArticolo","Ltd");

var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;

// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// numero progressivo
var cellFirst = row.insertCell(0);
var textNode = document.createTextNode(iteration);

cellFirst.appendChild(textNode);

// edit per il valore da ricercare sul campo
var cellOne = row.insertCell(1);

var el = document.createElement("input");
el.setAttribute('type', 'text');
el.setAttribute('size', '40');
el.setAttribute('name', 'EditFieldValue' + iteration);
cellOne.appendChild(el);
}

function removeRowFromTable()
{
var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}

function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open("", "TableAddRowNewWindow",

'scrollbars=yes,menubar=yes,resizable=yes,toolbar= no,width=400,height=400');

// set the target to the blank window
frm.target = "TableAddRowNewWindow";

// submit
frm.submit();
}
</script>

<form action="tableaddrow_nw.html" method="get">

<input type="button" value="Add" onclick="addRowToTable();" />
<input type="button" value="Remove" onclick="removeRowFromTable();" />
<input type="button" value="Submit" onclick="openInNewWindow(this.form);" />
<table border="1" id="SearchTable">
<tr>
<th colspan="5">Sample table</th>
</tr>
<tr>
<td>1</td>
<td><input type="text" name="EditFieldValue1" size="40" /></td>
</tr>
</table>

</form>
Jul 23 '05 #1
1 4819
SAN CAZIANO wrote:
I have create a dynamic html table by adding some rows where I have to put some value in an input field and now how can I get all value of all row ???
I try this but it doesn' work
button onclik=Alert("EditFieldValue2.value");

Please reply me as soon as possible.

<script>
function addRowToTable()
{
var FieldArray=new Array("ID","CodiceArticolo","Ltd");

var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;

// if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// numero progressivo
var cellFirst = row.insertCell(0);
var textNode = document.createTextNode(iteration);

cellFirst.appendChild(textNode);

// edit per il valore da ricercare sul campo
var cellOne = row.insertCell(1);

var el = document.createElement("input");
el.setAttribute('type', 'text');
el.setAttribute('size', '40');
el.setAttribute('name', 'EditFieldValue' + iteration);
cellOne.appendChild(el);
}

function removeRowFromTable()
{
var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}

function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open("", "TableAddRowNewWindow",

'scrollbars=yes,menubar=yes,resizable=yes,toolbar= no,width=400,height=400');
// set the target to the blank window
frm.target = "TableAddRowNewWindow";

// submit
frm.submit();
}
</script>

<form action="tableaddrow_nw.html" method="get">

<input type="button" value="Add" onclick="addRowToTable();" />
<input type="button" value="Remove" onclick="removeRowFromTable();" /> <input type="button" value="Submit" onclick="openInNewWindow(this.form);" /> <table border="1" id="SearchTable">
<tr>
<th colspan="5">Sample table</th>
</tr>
<tr>
<td>1</td>
<td><input type="text" name="EditFieldValue1" size="40" /></td>
</tr>
</table>

</form>
This is a mess:
button onclik=Alert("EditFieldValue2.value");


Most people would know what you're trying to do, but sloppiness does
not sit well with programming. In any event, you also didn't mention
browser/error message etc. so I'll assume Internet Explorer - which
doesn't add references to form elements generated with .createElement()
to either the document object or the form's .elements[] collection.
Might want to do it yourself:

<input type="button" value="Add" onclick="addRowToTable(this.form);" />
<input type="button" value="Remove"
onclick="removeRowFromTable(this.form);" />
.................
function addRowToTable(frm)
{
var FieldArray=new Array("ID","CodiceArticolo","Ltd");
var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// numero progressivo
var cellFirst = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellFirst.appendChild(textNode);
// edit per il valore da ricercare sul campo
var cellOne = row.insertCell(1);
var el = document.createElement("input");
el.setAttribute('type', 'text');
el.setAttribute('size', '40');
el.setAttribute('name', 'EditFieldValue' + iteration);
frm[el.name] = frm.elements[el.name] = el;
cellOne.appendChild(el);
}

function removeRowFromTable(frm)
{
var tbl = document.getElementById('SearchTable');
var lastRow = tbl.rows.length;
if (lastRow > 2)
{
tbl.deleteRow(lastRow - 1);
frm['EditFieldValue' + --lastRow] = frm.elements['EditFieldValue' +
lastRow] = null;
}
}

btw it's <input type="button" value="show"
onclick="alert(EditFieldValue2.value)">

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard G. | last post by:
Hi All, I am newbie in XML. I am designing a dynamic menu and retrieving data from xml. I have the xml file something like this: <?xml version="1.0" ?> <ROOT>
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
5
by: drdave | last post by:
Hi, I have 6 forms being generated using coldFusion, they are named special1, special2 special3 and so on.. in these forms I have a link to open a new window. I am trying to pickup the...
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
5
by: devx777 | last post by:
Hello, I am trying to find some information or an example on how to build a dynamic query in DB2 that would allow me to join a table which its name is stored as a field value on another table....
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
3
by: arunank | last post by:
Hi, The following code for dynamic table creation is not working. Can anyone please help me. The dynamically created rows and columns are not getting populated. CODE: ========= <html>
4
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the...
12
by: ive1122 | last post by:
Hi guys, I am looking into create a dynamic survey as posted in Get User Input From Dynamic Controls but with some different environment Below is what i am trying to do: First when the user...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.