Results 1 to 7 of 7
  1. #1
    sandy1000's Avatar
    sandy1000 is offline Member
    Join Date
    Dec 2010
    Posts
    11
    Rep Power
    0

    Smile dynamic table preparation+html+javascript

    <HTML>
    <HEAD>
    <TITLE> Add/Remove dynamic rows in HTML table </TITLE>
    <SCRIPT language="javascript">
    function addRow(tableID) {

    var table = document.getElementById(tableID);

    var rowCount = table.rows.length;
    var iteration=rowCount;

    if(iteration==0)
    {
    location.reload(true);
    }

    var x=document.getElementById(tableID).rows[iteration-1].cells;
    var last_row_idx= x[1].innerHTML;
    var row = table.insertRow(rowCount);

    var cell1 = row.insertCell(0);
    var element1 = document.createElement("input");
    element1.type = "checkbox";
    var cal_idx= parseInt(last_row_idx)+ 1;
    element1.id= "index"+ cal_idx+0;
    cell1.appendChild(element1);

    var cell2 = row.insertCell(1);
    cell2.innerHTML = parseInt(last_row_idx) + 1;


    var cell3 = row.insertCell(2);
    var element2 = document.createElement("input");
    element2.id= "index"+ cal_idx+2;
    element2.type = "text";

    cell3.appendChild(element2);

    var cell4 = row.insertCell(3);
    var sel = document.createElement('select');
    sel.name = "index"+ cal_idx+3;
    sel.id = "index"+ cal_idx+3;

    sel.options[0] = new Option('Single Storied Building', 'Single Storied Building');
    sel.options[1] = new Option('Multi Storied Building', 'Multi Storied Building');
    cell4.appendChild(sel);

    var cell5 = row.insertCell(4);
    var element5 = document.createElement('input');
    element5.type="text";
    element5.id= "index"+ cal_idx+4;
    cell5.appendChild(element5);



    var cell6 = row.insertCell(5);
    var element6 = document.createElement('input');
    element6.type="text";
    element6.id= "index"+ cal_idx+5;
    cell6.appendChild(element6);


    var cell7 = row.insertCell(6);
    var sel6 = document.createElement('select');
    sel6.name = "index"+ cal_idx+6;
    sel6.id = "index"+ cal_idx +6;

    sel6.options[0] = new Option('Complete', 'Complete');
    sel6.options[1] = new Option('OnGoing', 'OnGoing');
    sel6.options[2] = new Option('Not Started', 'Not Started');
    cell7.appendChild(sel6);



    }

    function deleteRow(tableID) {
    try {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;

    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    table.deleteRow(i);
    rowCount--;
    i--;
    }

    }
    }catch(e) {
    alert(e);
    }
    }

    </SCRIPT>
    </HEAD>
    <BODY>

    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />

    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE width="775" border="1">
    <TR>
    <TD width="23">
    Ck </TD>
    <TD width="16">
    Sl </TD>
    <td width="140">
    Wrk Year </td>
    <td width="165">
    Wrk Type </td>
    <td width="142">
    Wrk Des </td>
    <td width="145">
    Wrk Val </td>
    <td width="98">
    Wrk Stat </td>
    </TR>
    </TABLE>
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD><INPUT type="checkbox" name="index10" id="index10"/></TD>
    <TD> 1 </TD>
    <TD> <INPUT type="text" name="index12" id="index12"/> </TD>
    <TD><select name="index13" id="index13">
    <option>Single Storied Building</option>
    <option>Multi Storied Building</option>
    </select>
    </TD>
    <TD> <INPUT type="text" name="index14" id="index14"/> </TD>
    <TD> <INPUT type="text" name="index15" id="index15"/> </TD>
    <TD><select name="index16" id="index16">
    <option>Complete</option>
    <option>Ongoing</option>
    <option>Not Started</option>
    </select>
    </TD>
    </TR>
    </TABLE>

    </BODY>
    </HTML>

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default

    Again...where's the Java or JSP stuff in this?
    It's all Javascript?

    This is a Java forum you know...

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default

    Then start your own thread instead of grabbing someone else's (albeit an irrelevant thread as far as Java is concerned).

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default

    Which bit of "start your own thread" did you not understand?

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default

    You are hijacking someone elses thread.
    Go and start your own one and ask your question there.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default

    This thread (ie where you are posting) was started by sandy1000. Unless you are sandy1000 in disguise you are hijacking the thread.

  7. #7
    jerald55 is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default Jsp with Ajax Please Help Me

    Ohhh Sorry Boss in java there is a thread i confused with that..,

    Sorry Boss k did you know the answer for my question..?

    k now i'm going to create one thread..,
    if u answer please help me..,

    Sorry Sandy1000

Similar Threads

  1. Problem--How to create dynamic tree structure in jsp using javascript
    By natu in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-11-2010, 08:11 AM
  2. HonoGenerate for Java,jsp,html,javascript,css
    By jaapnap in forum Reviews / Advertising
    Replies: 0
    Last Post: 12-05-2009, 11:56 PM
  3. struts html tags vs javascript
    By murali in forum Web Frameworks
    Replies: 0
    Last Post: 12-01-2008, 02:18 PM
  4. Dynamic Table using JSP
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-27-2008, 03:13 AM
  5. About dynamic HTML framework using JAVA
    By swap_surade in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2008, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •