Friday, August 29, 2008

Add Multiple rows dynamically by clicking Add New Button

Copy the javascript coding & paste it in head.

<1script type="text/javascript">
function AddRow()
{

var dcname =document.getElementById("dcname");
var dqty =document.getElementById("dqty");
var dstype =document.getElementById("dstype");
var dnature =document.getElementById("dnature");
var morerow=document.getElementById("tbl")
var newtr = document.createElement("tr");

var newtd1 = document.createElement("td");
newtd1.innerHTML = dcname.innerHTML;
newtr.appendChild(newtd1);
var newtd2 = document.createElement("td");
newtd2.innerHTML = dqty.innerHTML;
newtr.appendChild(newtd2);
morerow.appendChild(newtr);
var newtd3 = document.createElement("td");
newtd3.innerHTML = dstype.innerHTML;
newtr.appendChild(newtd3);

var newtd4 = document.createElement("td");
newtd4.innerHTML = dnature.innerHTML;
newtr.appendChild(newtd4);
}
<1/script>

Paste the below content in the body section
<1table width="100%">
<1tbody id="tbl">
<1tr>
<1td><1div align="center">Chemical Name <1/div><1/td>
<1td><1div align="center">Quantity<1/div><1/td>
<1td><1div align="center">Storage Type <1/div><1/td>
<1td><1div align="center">Nature Of <1/div><1/td>
<1td> <1/td>

<1tr>
<1td><1input name="cname[]" type="text" id="cname" style="font-size:10;">
<1td><1input type="text" name="qty[]" id="qty" style="font-size:10;">
<1td><1input name="stype[]" type="text" id="stype" size="10">
<1td><1input type="text" name="natureof[]" id="natureof" style="font-size:10;">
<1td><1input name="Add" type="button" value="add" onclick="return AddRow();">
<1/tr>
<1/tbody>

<1div id="dcname" style="display:none; visibility:hidden"><1input name="cname[]" type="text" id="cname" size="10"><1/div>
<1div id="dqty" style="display:none; visibility:hidden"><1input type="text" name="qty[]" id="qty" size="10"><1/div>
<1div id="dstype" style="display:none; visibility:hidden"><1input type="text" name="stype[]" id="stype"><1/div>
<1div id="dnature" style="display:none; visibility:hidden">

<1input type="text" name="natureof[]" id="natureof" size="10"><1/div>

That's it now you have created a single row and by clicking add new it will add any number of rows dynamically

Note : Remove 1 on every html tag

10 comments:

Anonymous said...

I want to add serial no. which will increment after adding every new row

thanks

Anonymous said...

not workin in IE..

Anonymous said...

What about adding that data dynamically to database??, is there a way to create columns that alter dynamically as the row here added?? Awaiting replies...

Manjot kaur said...

You have written wonderful article. Greetings and thank you..

6 Month php Industrial Training in Chandigarh
6 weeks php industrial training in chandigarh

Naviya Nair said...

Great Article..
PHP Training in Chennai
Online PHP Training
Online PHP Training India
PHP Training Chennai
PHP Training institute in Chennai

Bhavya Kumar said...

My friend Suggest me this blog and I can say this is the best blog to get the basic knowledge.Thank you so much for this Selenium Training in Chennai

CIIT Noida said...

CIITN is the best SAP training and placement Institute in noida. Contestant will analyze in keeping with modern-day enterprise trends by way of certified and industry experts & SAP training Institute in Noida. They provide a 100% placement help with the best training of IT cousrses.

If you are looking best sap training in Noida then you can join CIITN. One of the premier training and development institute for SAP Training Program in Noida. The company provides 6 weeks/ 6 Months Training for SAP. They provide training in all SAP Modules like SAP HANA,SAP B1, SAP FICO etc. Just come for free demo class and then join SAP and move up in your career .

SAP Training Institute in Noida
sap training in noida
sap institute in noida
sap course in noida
best sap training institute in noida

CIIT Noida said...

CIIT Noida provides Best MCA Courses in Noida based on the current IT industry standards that help students to get high paying jobs in Top MNCs. CIIT provides Best MCA Training in Noida, Greater Noida, and Ghaziabad. CIIT is one of the trusted MCA training institutes in Noida providing practical knowledge and 100% job assistance with basic as well as advanced level MCA subjects. CIITN is the best MCA college in Noida, greater noida, ghaziabad, delhi, gurgaon regoin.

At CIIT MCA classes in Noida is conducted by subject experts corporate professionals with 9+ years of experience in managing real-time and live projects. Sofracle Nano Specialized MCA classes Noida is the perfect blend of academic learning and practical sessions to provide maximum exposure to students that transform an average student into a corporate professional whom companies prefer to hire.

Best MCA College in Noida

Chase4Net IT Solutions said...

Best Website Design company - PHP,JAVA,ANDROID App Developement Company

Chase4Net is a Software Company and having office at Chennai & bangalore . Our main focus areas are Web Development and Software Development.
Chase4Net has been ranked as the No.1 for the web designing company in Chennai & Bangalore.

How to start the Online Bussiness ?

To start the Business in online is very simple and more profitable . Today starting the Website desining Company is one of the more profitable business with less invesment.

We are having the talented Team with 8 years Expereince in webdesign business , which will guide to start the software company quickly with lesss effort.

Now a days all the business are moving towards online . Too start the company we need correct Business Model and thats Chase4Net . We will help you to setup the Website design Company at less cost . The website desing compnay can offer the following Logo design,website design , webhosting , domain registartion ,android app development .

Even If you do not know how to develop wensite no woriess . Chase4Net will be there always with you , we can help you on the business by developing a websiite a behalf og you.


We also have team who deloped application such as Hotel booking website design |, bus tickect booking website desing | , shopping cart website desing | , hospital website desing |,
bill software desing |,job website design |,tickect booking website design | ,matrimonial website design |,RealEstate website design .

You just become a website design company reseller program , We will take you to the next level.

Enter into partnership with us so that we can help you to setup your business including website design for your company,Email-Id creation,Web Hosting membership,Domain Reseller membership,Payment Gateway Integration,SMS Integration.Chase4Net ensures
you to start the business from day one rather than making you run behind business plans.To be our franchise we charge as low asINR Rs 20000/- (or) $296To pay the franchise membership fee How to pay

Chase4Net IT Solutions said...

How to start the software company ?

Best Website Design company - PHP,JAVA,ANDROID App Developement Company

Chase4Net is a Software Company and having office at Chennai & bangalore . Our main focus areas are Web Development and Software Development.
Chase4Net has been ranked as the No.1 for the web designing company in Chennai & Bangalore.

To start the in Software comany is very simple and more profitable . To start the business first you need a Team which supprt for your everything.
In todays software development is nothing but a web application . To develop a webapplication you need start the Website desining Company is one of the more profitable business with less invesment.

We are having the talented Team with 8 years Expereince in webdesign business , which will guide to start the software company quickly with lesss effort.

There are many business includes in website developmet - Logo design,website design , webhosting , domain registartion ,android app development .

Even If you do not how to develop wensite no woriess . Chase4Net will be there always with you , we can help you on the business by developing a websiite a behalf og you.


We also have team who deloped application such as Hotel booking website development |, bus tickect booking website development | , shopping website development | , hospital website development |,
bill software desing | ,job website development |, tickect booking website development | ,matrimonial website development |,RealEstate website development .

You just become a website design company by website desgin reseller program , We will take you to the next level.

Enter into partnership with us so that we can help you to setup your business including website design for your company,Email-Id creation,Web Hosting membership,Domain Reseller membership,Payment Gateway Integration,SMS Integration.Chase4Net ensures
you to start the business from day one rather than making you run behind business plans.To be our franchise we charge as low as INR Rs 20000/- (or) $296To pay the franchise membership fee.How to pay