Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] createElements(): new row in table
- From: borchers at tridem.de (Michael Borchers)
- Subject: [Javascript] createElements(): new row in table
- Date: Wed Sep 28 04:46:12 2005
<http://michaelborchers.net/js/dom2.php> http://michaelborchers.net/js/dom2.php so far so good, adding a single cell in a row with an id works fine, but i can't add a complete row. please see the script which was supposed to do both, what's wrong? function addOrdersNumRows() { var ordersNumRowsAdded = document.getElementById("orders_num_rows_added").value; for(o=0;o<ordersNumRowsAdded;o++) { mycurrent_cell=document.createElement("TD"); mySelect = document.createElement("select"); mySelect.setAttribute("name","products_id[1][products_id]"); theOption=document.createElement("OPTION"); theText=document.createTextNode("Produkte"); theOption.appendChild(theText); theOption.setAttribute("value","1"); mySelect.appendChild(theOption); mycurrent_cell.appendChild(mySelect); document.getElementById('trProducts').appendChild(mycurrent_cell); //---------------------------------------------------------------------- // works fine, but... //---------------------------------------------------------------------- mycurrent_row=document.createElement("TR"); mycurrent_cell=document.createElement("TD"); mySelect = document.createElement("select"); mySelect.setAttribute("name","products_id[1][products_id]"); theOption=document.createElement("OPTION"); theText=document.createTextNode("Produkte"); theOption.appendChild(theText); theOption.setAttribute("value","1"); mySelect.appendChild(theOption); mycurrent_cell.appendChild(mySelect); mycurrent_row.appendChild(mycurrent_cell) ; document.getElementById('tableProducts').appendChild(mycurrent_row); //---------------------------------------------------------------------- // won't work:( //---------------------------------------------------------------------- } // for } -------------- n?chster Teil -------------- Ein Dateianhang mit HTML-Daten wurde abgetrennt... URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20050928/56805c65/attachment-0001.html
- Prev by Date: [Javascript] counting selects
- Next by Date: AW: [Javascript] createElements(): new row in table
- Previous by thread: [Javascript] counting selects
- Next by thread: AW: [Javascript] createElements(): new row in table
- Index(es):