Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Creating-deleting rows in HTML(URGENT)

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How can I create or delete the rows of the table when I click the button in HTML
Please let me know
Thanks in advance
Angela
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my code:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function deleteValues(){
anuja.deleteRow(2)
}
function insertValues(){
anuja.insertRow()
}
</SCRIPT>
<body>
<table id = anuja border="1" width="42%">
<TR BGCOLOR=="#FF0000">
<TD BGCOLOR="#FF0000" width="23%">                    
<b>CONTROLLER</b></td>
<TD BGCOLOR="#FF0000" width="77%" >  <b> MODEL</b></td>
</tr>
<TR>
<TD width="23%">                
7040</td>
<td id = ip_421_value width="77%"><div name="IP-421">IP-421</div></td>
</tr>
<TR>
<TD width="23%">                
7050</td>
<td id = ip_421j width="77%"><div name="IP-421J">IP-421J</div></td>
</tr>
<TR>
<TD width="23%">              
7060</td>
<td id = ip_601 width="77%"><div name="IP-601">IP-601</div></td>
</tr>
</table>
<p><input type="submit" value="Insert" name="B1" OnClick ="insertValues()">
<input type="button" value="Delete" name="B3" OnClick ="deleteValues()"></p>
</body>
</html>
I can able to insert row and delete rows. But in insertrows, I cannot able to add cells
Please let me know
Thanks
Angela
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I finally solve it! Here is my code:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function deleteValues(){
anuja.deleteRow(2)
}
function insertValues(){
aRow = anuja.insertRow();
aCell1 = aRow.insertCell();
aCell1.innerText = "Hello";
aCell2 = aRow.insertCell();
aCell2.innerText = "Hi";
}
</SCRIPT>
<body>
<table id = "anuja" border="1" width="42%">
<TR BGCOLOR=="#FF0000">
<TD BGCOLOR="#FF0000" width="23%">                    
<b>CONTROLLER</b></td>
<TD BGCOLOR="#FF0000" width="77%" >  <b> MODEL</b></td>
</tr>
<TR>
<TD width="23%">                
7040</td>
<td id = ip_421_value width="77%">IP-421</td>
</tr>
<TR>
<TD width="23%">                
7050</td>
<td id = ip_421j width="77%">IP-421J</td>
</tr>
<TR>
<TD width="23%">              
7060</td>
<td id = ip_601 width="77%">IP-601</td>
</tr>
</table>
<p><input type="submit" value="Insert" name="B1" OnClick ="insertValues()">
<input type="button" value="Delete" name="B3" OnClick ="deleteValues()"></p>
</body>
</html>
Thanks
Angela
reply
    Bookmark Topic Watch Topic
  • New Topic