Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Adding new row Using JavaScript.

Author: DevASP
Download Source Code :

This article is about how you can add a new row in you web form using JavaScript. If you want to add a new row in the table of your web form you didn’t need to go back to the server so that.........


Steps you will do.



Start visual studio and create a new web application.


Open the HTML design of your web page and add the following JavaScript functions before closing the head tag.




  function addRow(id){

    var tbody = document.getElementById


    var row = document.createElement("TR")

    var td1 = document.createElement("TD")

    td1.appendChild(document.createTextNode("column 1"))

    var td2 = document.createElement("TD")

    td2.appendChild (document.createTextNode("column 2"))








Add the following HTML code to design the layout of your web page.



<BODY bgcolor=#009999>


<h3>Dont forget to visit<br>

<a href=""></a>



<a href="javascript:addRow('myTable')">Add row</a>

<table id="myTable" cellspacing="0" border="1">












Run you application and click the link to add new row in the table.




Article Comments

If I add it to a form for a text box, then how could I get it's value from code behind, I was trying to get it with request.form, but it was not working. If you could give me an example, I will b so greatful to you.

Posted on 3/2/2007 11:13:07 AM by ceema

Adding new row Using JavaScript.

Posted on 4/6/2007 2:09:41 AM by Senthil Kumar

Thank u about the script. please subscribe any any script in my account. your readers.

Posted on 4/12/2007 5:53:19 AM by soubam koginoor

Add Article Comment:
Name :
Email Address :
Comments :
<< Implementing Filter Effect on an Image.

Disclaimer - Privacy
© 2002-2017