Wednesday, July 9, 2014

Dynamically Add/Remove Rows in HTML Table Using Javascript

Following code snippet will show how to dynamically add/remove rows in Table using simple HTML and Javascript :

Source Code :
 HTML Table :  
   
 <table cellspacing=0 cellpadding=0 border=0 border-spacing=10px id="attributes_configuration_table">  
   <thead>    
     <tr>          
       <th><b>Name</b></th>             
       <th><b>Value</b></th>    
     </tr>  
   </thead>  
   <tbody>    
       <tr id="row_1">          
       <td>            
         <input type="text" name="attribute_name_1" id="attribute_name_1" style="margin-right:10px" autocomplete="off">                  
     </td>              
       <td>            
         <input type="text" name="attribute_value_1" id="attribute_value_1" style="margin-right:10px" autocomplete="off">          
       </td>        
       <td><input class="new_button" id="+" name="+" onclick="addTableRow('attributes_configuration_table')" type="button" value="+">  
       </td>    
     </tr>  
   </tbody>  
 </table>  

JavaScript :
 var counter = 1;  
 function addTableRow(TableId) {  
   var table = document.getElementById(TableId);  
   counter++;  
   var rowCount = table.rows.length;  
   var row = table.insertRow(rowCount);  
   row.id = 'row_' + counter;  
   
   var cell1 = row.insertCell(0);  
   var element1 = document.createElement("input");  
   element1.type = "text";  
   element1.autocomplete = "off";  
   element1.name="attribute_name_" + counter;  
   cell1.appendChild(element1);   
   
   var cell2 = row.insertCell(1);  
   var element2 = document.createElement("input");  
   element2.type = "text";  
   element2.autocomplete = "off";  
   element2.name="attribute_value_" + counter;  
   cell2.appendChild(element2);  
       
   var cell3 = row.insertCell(2);  
   var newButton    = document.createElement("input");  
   newButton.className = "new_button";  
   newButton.type   = "button";  
   newButton.value   = '-';  
   newButton.onclick  = removeRow;  
   cell3.appendChild(newButton);  
 }  
   
 function removeRow (id) {  
   var rowNode = this.parentNode.parentNode;  
   // Delete this node  
   rowNode.parentNode.removeChild(rowNode);  
 }  

Live Demo

Sunday, May 25, 2014

सपना...एक तसब्बुर



हे प्रिये चलो मैं आज तुम्हे कुछ और ही बात बताता हूँ
जिस दुनियाँ में सपने बस्ते हैं उस दुनिया की सैर कराता हूँ
ना बंदिश है ना पाबंदी ना तीखी नज़रें हैं दुनियाँ वालों की
बस एक मैं हूँ और एक तुम और सपने हैं दिलवालों की

उन बागों की शैर करें जहाँ फूल प्यार के खिलतें हैं
उस क्षितिज के पास चलें जहाँ ज़मीन आसमान से मिलतें हैं
उन झरनों के पास चलें जो संगीत प्यार का सुनाती है
उन तारों के पार चलें जो रोज़ हमें बुलाती है

कितनी प्यारी है ये दुनियाँ जो की सपनो मे रहती है
किसी और की नही यहाँ बस अपनी मर्ज़ी इसमे चलती है

प्यारे सचमुच हैं ये सपने क्यूंकी यहीं हम तुमसे मिलते है
ये सपना ना जाने कब सच हो बस इंतज़ार इसी का करते हैं



Wednesday, March 5, 2014

Remembering Jamsetji Tata - Legendary Father of Indian Industry

3 March, 2014 - 175th birth anniversary of Jamshetji Tata, One of the big founders of Modern India. He was the founder of Tata Group, India's biggest conglomerate company.


Jamshetji Tata (3 March 1839 – 19 May 1904)
Jamsetji Tata was a great visionary and businessman who had devoted his life to set up :

  • A World Class Steel & Iron Company (TATA Steel)
  • A World Class Institution (IISC Bangalore)
  • A Unique Hotel (Taj Mahal Hotel, Mumbai)
  • A Hydro-Electric Power Plant (TATA Power)


Our first Prime Minister Jawaharlal Nehru once said - 
"When you have to give the lead in action, in ideas - a lead which does not fit in with the very climate of opinion - that is true courage, physical or mental or spiritual, call it what you like, and it is this type of courage and vision that Jamsetji Tata showed. It is right that we should honour his memory and remember him as one of the big founders of modern India."

We pay our tribute to the legend, who had founded the TATA Group - Largest Conglomerate of India - which operates in more than 100 Countries and markets in 6 Continents and made every Indian proud, on his 175th birth anniversary.

To Know More about Jamshetji Tata, Please visit following websites :