By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,494 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,494 IT Pros & Developers. It's quick & easy.

php and ajax dynamically created select box onchange event

P: 11
i want to basically take some information for the product and let the user
enter the the material required to make this product

1.first page test.php
which takes product code and displays prodcut anme have used
ajax to avoid refreshing of page this works fine
2.now i have created one row with
checkbox|select box|text|text|text|text|
where in the select box values are fetched from table here also i have used ajax for getting the m_name automatically withput refreshi works fine (onchange event)
3.after that i have given a add rows button on which rows are added dynamically
with the same like static row i have added
now i wantto use the same function i have used for static select box for avoiding refreshing here how do i pass the onchange event here
and after pressing submit button the dynamic rows created disappears
can anybody help me wot is wrong with this

how do i pass dynamic elements values from the rows to the php along with the static row values
my code is as follows

Expand|Select|Wrap|Line Numbers
  1. test.php
  2.  
  3.  
  4. <?
  5.  
  6. include("../include/connection.php");
  7. if($_GET)
  8. {
  9. $p_cde=$_GET['p_cde'];
  10.  
  11. $cnt = count($_GET['m_cde'])+1;
  12.       for ($idx=0;$idx<=$cnt;$idx++) {
  13.           $m_cde= $_GET['m_cde'][$idx] ;
  14.           $m_name=$_GET['m_name'][$idx]; 
  15.           $um=$_GET['um'][$idx]; 
  16.           $qty=$_GET['qty'][$idx]; 
  17.           $overages=$_GET['overages'][$idx]; 
  18.      }
  19. }
  20. ?>
  21. <html>
  22. <head>
  23. <script src="test.js" ></script>
  24. </head>
  25. <body><form name="material" method="GET"> 
  26. <table id="tbl" border="1">
  27. <tr><td>
  28. <select name="p_cde" id="p_cde" onChange="showCode(this.value);">
  29.    <? 
  30.    $sqlpr = "select * from fgmaster order by p_cde ";
  31.     $db_query=$DB_site->query($sqlpr);
  32.     while($rspr=$DB_site->fetch_array($db_query)){
  33.                $combopr=$combopr."<option value='".$rspr['p_cde']."'";
  34.             if ($rspr['p_cde']==strtoupper($p_cde)){
  35.                 $combopr=$combopr."selected";
  36.                 }
  37.             $combopr=$combopr.">".$rspr['p_cde']."-".$rspr['p_name']."</option>\n";
  38.        }
  39.        echo $combopr;   
  40.  
  41.        ?> 
  42. </select>
  43. </td>
  44.  
  45. <td><input type="text" name="p_name" id="p_name" value=""></td>
  46. <td><input type="text" name="p_pckunit" id="p_pckunit" value=""></td></tr>
  47. <?
  48.     $sqlmaterial="select * from materialmaster order by m_cde";
  49.     $db_query_material=$DB_site->query($sqlmaterial);
  50.     while($rsmaterial=$DB_site->fetch_array($db_query_material)){
  51.                 $option_vals[]=$rsmaterial['m_cde']."-".$rsmaterial['m_name'];
  52. }
  53.     ?>
  54. <script>
  55. select_opt = new Array();
  56. <?
  57. for($i=0;$i<count($option_vals);$i++){
  58.     ?>
  59.         select_opt[<?= $i ?>] = '<?= $option_vals[$i] ?>';
  60.     <?
  61. }
  62. ?>
  63. </SCRIPT>
  64.  
  65. <tr bgcolor="#CCCCCC" bordercolor="#FFCCFF"> 
  66.       <th>&nbsp;&nbsp; </th>
  67.  
  68.       <th >Code</th>
  69.  
  70.       <th>Material description</th>
  71.  
  72.       <th>um</th>
  73.  
  74.       <th>qty</th>
  75.  
  76.       <th>overages</th>
  77.  
  78.  
  79.  
  80.     </tr>
  81.  
  82.  
  83.      <tr> 
  84.      <td><input type="checkbox" name="chk" id="chk"></td>
  85.         <td><select name='m_cde' id='m_cde' onChange='showmcode(this.value);'>
  86.            <? 
  87.            $sqlmr = "select * from materialmaster order by m_cde ";
  88.         $db_query_mr=$DB_site->query($sqlmr);
  89.         while($rsmr=$DB_site->fetch_array($db_query_mr)){
  90.                $combomr=$combomr."<option value='".$rsmr['m_cde']."'";
  91.             if ($rsmr['m_cde']==strtoupper($m_cde)){
  92.                 $combomr=$combomr."selected";
  93.                 }
  94.         $combomr=$combomr.">".$rsmr['m_cde']."-".$rsmr['m_name']."</option>\n";
  95.            }
  96.            echo $combomr;   
  97.         ?> 
  98.     </select></td>
  99.     </td><td><input type="text" name='m_name' id='m_name' value=""></td>
  100.     <td><input type="text" name='um' id='um' value=""></td>
  101.     <td><input type="text" name='qty' id='qty' value=""></td>
  102.     <td><input type="text" name='overages' id='overages' value=""></td>
  103.     </tr> 
  104.  
  105.     <tbody>
  106. </tbody>
  107. </table>
  108. <DIV>
  109. <input type ="button" value="Add Row" onclick="add_rows(document.getElementById('tbl'));">
  110. </div>
  111. <DIV><input type ="submit" value="Submit" name="myfields"></DIV>
  112. </form>
  113. </body>
  114. </html>
Expand|Select|Wrap|Line Numbers
  1. test.js
  2. ------------
  3. // JavaScript Document
  4. var xmlHttp;
  5. function showCode(str)
  6. xmlHttp=GetXmlHttpObject();   //Calls on the GetXmlHttpObject function to create an XMLHTTP object 
  7. if (xmlHttp==null)
  8.  {
  9.  alert ("Browser does not support HTTP Request");
  10.  return;
  11.  }
  12. var url="testget.php"; //Defines the url (filename) to send to the server 
  13. url=url+"?p_cde="+str;  //Adds a parameter (q) to the url with the content of the dropdown box 
  14. url=url+"&sid="+Math.random(); //Adds a random number to prevent the server from using a cached file 
  15. xmlHttp.onreadystatechange=stateChanged ; //Call stateChanged when a change is triggered 
  16. xmlHttp.open("GET",url,true);  //Opens the XMLHTTP object with the given url. 
  17. xmlHttp.send(null);                //Sends an HTTP request to the server 
  18. alert(url);
  19. }
  20. function showmcode(str)
  21. xmlHttp=GetXmlHttpObject();   //Calls on the GetXmlHttpObject function to create an XMLHTTP object 
  22. alert(str);
  23. if (xmlHttp==null)
  24.  {
  25.  alert ("Browser does not support HTTP Request");
  26.  return;
  27.  }
  28. var url="testget.php"; //Defines the url (filename) to send to the server 
  29. url=url+"?m_cde="+str;  //Adds a parameter (q) to the url with the content of the dropdown box 
  30. url=url+"&sid="+Math.random(); //Adds a random number to prevent the server from using a cached file 
  31. xmlHttp.onreadystatechange=stateChanged1 ; //Call stateChanged when a change is triggered 
  32. xmlHttp.open("GET",url,true);  //Opens the XMLHTTP object with the given url. 
  33. xmlHttp.send(null);                //Sends an HTTP request to the server 
  34. alert(url);
  35. }
  36. function stateChanged() 
  37. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  38.  { 
  39.  
  40.    var ar=xmlHttp.responseText.split("|");
  41.  
  42.    document.getElementById("p_name").value=ar[0] ;
  43.    document.getElementById("p_pckunit").value=ar[1] ;
  44.  
  45.  
  46.  } 
  47. }
  48.  
  49. function stateChanged1() 
  50. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  51.  { 
  52.    var ar=xmlHttp.responseText.split("|");
  53.    document.getElementById("m_name").value=ar[0] ;
  54.    document.getElementById("um").value=ar[1] ;
  55.   } 
  56. }
  57. function GetXmlHttpObject()
  58. {
  59. var xmlHttp=null;
  60. try
  61.  {
  62.  // Firefox, Opera 8.0+, Safari
  63.  xmlHttp=new XMLHttpRequest();
  64.  }
  65. catch (e)
  66.  {
  67.  //Internet Explorer
  68.  try
  69.   {
  70.   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  71.   }
  72.  catch (e)
  73.   {
  74.   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  75.   }
  76.  }
  77. return xmlHttp;
  78. }
  79.  
  80.  
  81.  
  82. //FUNCTION FOR DYNAMIC ROW
  83.  
  84. j=0;
  85. function add_rows(obj){
  86.  
  87.     //tabObj = document.createElement("table");
  88.     //tbodyObj = document.createElement("tbody");
  89.  
  90.     tabCols = new init_table();
  91.     trObj = document.createElement("tr")
  92.     col_names = new Array("chk","m_cde","m_name","um","qty","overages"); 
  93.     for(i=0;i<tabCols.length;i++){
  94.         tdObj = document.createElement("td");
  95.         /*
  96.          if(create_object(tabCols[i])=="select")
  97.          {
  98.          mselect=create_object(tabCols[i],col_names[i]+'['+j+']')
  99.          mselect.onChange=showmcode(col_names[i]+'['+j+']');
  100.          tdObj.appendChild(mselect));
  101.          }*/
  102.  
  103.         tdObj.appendChild(create_object(tabCols[i],col_names[i]+'['+j+']'));
  104.  
  105.         //added on 04/09/2007 for onchage event on select box
  106. /*        if(tabCols[i]=="select"){
  107.         alert("hi");
  108.             col_names[i]+'['+j+']'="fieldevent('"+fieldname+"')";
  109.             var showmcode=new Function(col_names[i]+'['+j+']'.onchange);
  110.             if(col_names[i]+'['+j+']'.addEventListener){
  111.             col_names[i]+'['+j+']'.addEventListener('change',showmcode,false);
  112.             else if(col_names[i]+'['+j+']'.attachEvent){
  113.             col_names[i]+'['+j+']'.attachEvent('onchange',showmcode);}
  114.             }
  115.         /* this is a sample
  116.         sfield.onchange = "fieldevent('" + fieldname + "')"; 
  117.             var onChangeHandler = new Function(sfield.onchange); 
  118.             if (sfield.addEventListener) { 
  119.             sfield.addEventListener('change', onChangeHandler, false ); 
  120.             } else if (sfield.attachEvent) { 
  121.             sfield.attachEvent('onchange', onChangeHandler); 
  122.             } 
  123.             */
  124.             trObj.appendChild(tdObj);
  125.  
  126.     }
  127.     obj.firstChild.appendChild(trObj);
  128.  
  129.  
  130. j++;
  131.  
  132. }
  133.  
  134. function fieldevent(fname){ 
  135.  
  136. alert (fname); 
  137.  
  138.  
  139.  
  140. function init_table(){
  141.     tableProp = new Array();
  142.  
  143.     tableProp[0] = "checkbox";
  144.     tableProp[1] = "select"; //m_cde
  145.     tableProp[2] = "text"; //m_name
  146.     tableProp[3] = "text"; //um
  147.     tableProp[4] = "text"; //qty
  148.     tableProp[5] = "text"; //overages    
  149.     //tableProp[6] = "checkbox";
  150.  
  151.     return tableProp;
  152. }
  153.  
  154. function create_object(objType,nm){
  155.     if(objType == 'select'){
  156.         return getSelectBoxDOM(select_opt,nm);
  157.     }    
  158.  
  159.     obj = document.createElement("input");
  160.     obj.setAttribute("type",objType);
  161.     obj.setAttribute("name",nm);
  162.  
  163.  
  164.     return obj; 
  165. }
  166.  
  167. function getSelectBoxDOM(options,nm) {
  168.             selectBox =document.createElement('select');
  169.            for (x=0; x < options.length; x++) {
  170.                 optionItem =document.createElement('option');
  171.                    optionItem.appendChild(document.createTextNode(options[x]));
  172.                 selectBox.appendChild(optionItem);
  173.  
  174.  
  175.             }
  176.             selectBox.setAttribute("name",nm);
  177.  
  178.  
  179.            return selectBox;
  180.  
  181. }


Expand|Select|Wrap|Line Numbers
  1. testget.php
  2. ----------------
  3.  
  4.  
  5. <?php
  6. if($_GET)
  7. {
  8.  
  9. $p_cde=$_GET['p_cde']; 
  10.  
  11.  
  12. $con = mysql_connect('localhost', 'localhost', '');  //PHP opens a connection to a MySQL server 
  13.  
  14. if (!$con)
  15.  {
  16.  die('Could not connect: ' . mysql_error());
  17.  }
  18. mysql_select_db("erpmfg", $con);
  19. $sql="select * from fgmaster where p_cde = '".$p_cde."'";
  20. $result = mysql_query($sql);
  21. while($row = mysql_fetch_array($result)){
  22. $p_name=$row['p_name'];
  23. $p_pckunit=$row['p_pckunit'];
  24. echo $p_name."|".$p_pckunit;
  25. }
  26. }
  27.  
  28. if ($_GET)
  29. {
  30.  
  31. $m_cde=$_GET['m_cde'];
  32.  
  33. $sqlmr="select * from materialmaster where m_cde = '".$m_cde."'";
  34. $result1 = mysql_query($sqlmr);
  35.  
  36. while($row = mysql_fetch_array($result1)){
  37. $m_name=$row['m_name'];
  38. $um=$row['um'];
  39.  
  40. echo $m_name."|".$um;
  41. }
  42.  
  43.  
  44. mysql_close($con);
  45. ?>
Sep 5 '07 #1
Share this Question
Share on Google+
21 Replies


dmjpro
100+
P: 2,476
Please use Code tags then it will be easy to Solve your Problem.

Kind regards,
Dmjpro.
Sep 5 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Leena, welcome to TSDN!

Did you know that you can specify languages in the code tags, e.g. [code=javascript]...[/code.] (remove the dot).
Sep 5 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Give your dynamically created elements ids. For your select, add the onchange when you create the element.
Sep 5 '07 #4

P: 11
Expand|Select|Wrap|Line Numbers
  1. j=1;
  2. function add_rows(obj){
  3.  
  4.      tabCols = new init_table();
  5.      trObj = document.createElement("tr")
  6.      col_names = new Array("chk","m_cde","m_name","um","qty","overages"); 
  7.      for(i=0;i<tabCols.length;i++){
  8.         tdObj = document.createElement("td");
  9.         /*         if(create_object(tabCols[i])=="select")
  10.          {
  11.          mselect=create_object(tabCols[i],col_names[i]+'['+j+']')
  12.          mselect.onChange=showmcode(col_names[i]+'['+j+']');
  13.          tdObj.appendChild(mselect));
  14.          }*/
  15.  
  16.         tdObj.appendChild(create_object(tabCols[i],col_names[i]+'['+j+']'));


i was trying the above commented line in add_rows function while creating a select box using createElement function for onchange where am i going wrong
Sep 5 '07 #5

acoder
Expert Mod 15k+
P: 16,027
i was trying the above commented line in add_rows function while creating a select box using createElement function for onchange where am i going wrong
Use onchange (lower case "c").
Sep 5 '07 #6

P: 11
i tried that but then my add rows button does not create new row some error
but if comment that part then it works
how to give onchage event when the select box is created

Expand|Select|Wrap|Line Numbers
  1. function getSelectBoxDOM(options,nm) {
  2.             selectBox =document.createElement('select');
  3.            for (x=0; x < options.length; x++) {
  4.                 optionItem =document.createElement('option');
  5.                    optionItem.appendChild(document.createTextNode(options[x]));
  6.                 selectBox.appendChild(optionItem);
  7.  
  8.  
  9.             }
  10.             selectBox.setAttribute("name",nm);
  11.             selectBox.setAttribute("id",nm);
  12. //after this say selectBox.onchange=showmcode(nm.value)........ ??????
  13. where nm is the name of the selectbox
  14.            return selectBox;
  15. }           
  16.  
i tried this bt giving error property not supported

thanks.
Sep 5 '07 #7

acoder
Expert Mod 15k+
P: 16,027
Please use code tags when posting code. Thanks!

You need to assign a function object to the onchange, not the result of the function. See this article.

Try:
Expand|Select|Wrap|Line Numbers
  1. selectBox.onchange = function() {
  2.  showmcode(selectBox.value);
  3. }
Sep 5 '07 #8

P: 11
i tried that but then my add rows button does not create new row some error
but if comment that part then it works
how to give onchage event when the select box is created

Expand|Select|Wrap|Line Numbers
  1. function getSelectBoxDOM(options,nm) {
  2.             selectBox =document.createElement('select');
  3.            for (x=0; x < options.length; x++) {
  4.                 optionItem =document.createElement('option');
  5.                    optionItem.appendChild(document.createTextNode(options[x]));
  6.                 selectBox.appendChild(optionItem);
  7.  
  8.  
  9.             }
  10.             selectBox.setAttribute("name",nm);
  11.             selectBox.setAttribute("id",nm);
  12. //after this say selectBox.onchange=showmcode(nm.value)........ ??????
  13. where nm is the name of the selectbox
  14.            return selectBox;
  15. }           
  16.  
  17.  
i tried this bt giving error property not supported

thanks.
Sep 5 '07 #9

acoder
Expert Mod 15k+
P: 16,027
Make sure you use code tags. This is the final friendly request. The last post seems like a repeat of your previous comment.
Sep 5 '07 #10

P: 11
Expand|Select|Wrap|Line Numbers
  1. selectBox.onchange = function() {
  2.  showmcode(selectBox.value);
  3. }

i did this but now it add a record but once i select value from dynamically added select box the value of m_name is not shown in corresponding text box there and my static rows um and m_name disappears which i had selected and where onchange event it had executed ajax script to display m_name and um


thanks
Sep 5 '07 #11

acoder
Expert Mod 15k+
P: 16,027
Try
Expand|Select|Wrap|Line Numbers
  1. selectBox.onchange = function() {
  2.  showmcode(this.value);
  3. }
Don't forget to set the values of the option elements.
Sep 5 '07 #12

P: 11
same problem i changes it to this.value

i'm setting the options in the getselectbox function
and then actual database values are passed in test.php program

can't understand what is wrong with my code



thanks
Sep 6 '07 #13

markrawlingson
Expert 100+
P: 346
Try..

Expand|Select|Wrap|Line Numbers
  1. selectBox.onchange = function() {
  2.  showmcode(this.options[this.selectedIndex].value);
  3. }
  4.  
Sep 6 '07 #14

acoder
Expert Mod 15k+
P: 16,027
same problem i changes it to this.value

i'm setting the options in the getselectbox function
and then actual database values are passed in test.php program

can't understand what is wrong with my code
You're not setting the value of the options. Set the value by using .value or setAttribute, e.g.
Expand|Select|Wrap|Line Numbers
  1. optionItem.value = 'someval';
Sep 6 '07 #15

P: 11
i writing a code to create select box

Expand|Select|Wrap|Line Numbers
  1. function getSelectBoxDOM(options,nm) {
  2.             selectBox =document.createElement('select');
  3.            for (x=0; x < options.length; x++) {
  4.                 optionItem =document.createElement('option');
  5.                    optionItem.appendChild(document.createTextNode(options[x]));
  6.                 selectBox.appendChild(optionItem);
  7.            }
  8.             selectBox.setAttribute("name",nm);
  9.             selectBox.setAttribute("id",nm);
  10.             s=new function(){}
  11.             selectBox.onchange =new function() {
  12.                 showmcode(this.options[this.selectedIndex].value);
  13.             }
  14.            return selectBox;
  15. }
which is called here

Expand|Select|Wrap|Line Numbers
  1.  function create_object(objType,nm){
  2.     if(objType == 'select'){
  3.         return getSelectBoxDOM(select_opt,nm);
  4.         //select_opt.onchange = function() {
  5.             //    showmcode(this.options[this.selectedIndex].value);
  6.         //    }
  7.     }    
  8.  
  9.     obj = document.createElement("input");
  10.     obj.setAttribute("type",objType);
  11.     obj.setAttribute("name",nm);
  12.     obj.setAttribute("id",nm);
  13.  
  14.     return obj; 
  15. }
and when i'm adding rows the function create_object is called

Expand|Select|Wrap|Line Numbers
  1. function add_rows(obj){
  2.  
  3.     //tabObj = document.createElement("table");
  4.     //tbodyObj = document.createElement("tbody");
  5.  
  6.     tabCols = new init_table();
  7.     trObj = document.createElement("tr")
  8.     col_names = new Array("chk","m_cde","m_name","um","qty","overages"); 
  9.     for(i=0;i<tabCols.length;i++){
  10.         tdObj = document.createElement("td");
  11.         tdObj.appendChild(create_object(tabCols[i],col_names[i]+'['+j+']'));\
  12.         tdObj.appendChild(op.value);
  13.         trObj.appendChild(tdObj);
  14.     }
  15.     obj.firstChild.appendChild(trObj);
  16. j++;
  17. }
and in test.php i'm assigning values to options
so when the form is loaded select options are filled with database values



[PHP]<?
$sqlmaterial="select * from materialmaster order by m_cde";
$db_query_material=$DB_site->query($sqlmaterial);
while($rsmaterial=$DB_site->fetch_array($db_query_material)){
$option_vals[]=$rsmaterial['m_cde']."-".$rsmaterial['m_name'];
}
?>
<script>
select_opt = new Array();
<?
for($i=0;$i<count($option_vals);$i++){
?>
select_opt[<?= $i ?>] = '<?= $option_vals[$i] ?>';
<?
}
?>[/PHP]



now how and where to writea code to give onchange event to the select box
i tried create_object function where objtype="select" and where getselectbox function is called but same error.
i also tried in addrow function just after creating object ..
i'm new to ajax and dom
so please tell me how do do this
i have a static row where the same m_cde select box is there where this function is working prooerly
but when i do it for dynamic rows if i alert then it shows [object]
and with static rows it shows the allthe object created with id and all
also how do i pass the m_cde as arry to the url inthe showmcode function for rows .

thanks
Sep 6 '07 #16

P: 11
but i'm assigning values to select box in the main program test.php from the database to the javascript array variable
and creating the select boxes in the test.js
so is it because of that it is creating problem?
Sep 6 '07 #17

acoder
Expert Mod 15k+
P: 16,027
Change line 5 in getSelectBoxDOM to:
Expand|Select|Wrap|Line Numbers
  1. optionItem.text = options[x];
  2. optionItem.value = options[x];
You could use setAttribute if you want instead, e.g.
Expand|Select|Wrap|Line Numbers
  1. optionItem.setAttribute("value",options[x]);
Sep 7 '07 #18

P: 11
Thanks
my onchange event function works in select option
but then it gives me error in mozilla

Error: uncaught exception: [Exception... "Node cannot be inserted at the specified point in the hierarchy" code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"

this is in the add_rows function
when i try to append

Expand|Select|Wrap|Line Numbers
  1. tdObj.appendChild(create_object(tabCols[i],col_names[i]+'['+j+']'));
  2. trObj.appendChild(tdObj); }
  3. obj.firstChild.appendChild(trObj); //this line the above error occurs
  4.  
am i not setting the attributes in order the way it should for the objects created
and no rows are added dynamically
but in IE 6 it works and even the new rows are inserted
but the value of m_name is not assigned to the corresponding text box in then newly created row like it is shown in static row
how do i pass it in the test1.js in the statechaged1 corresponding to that row cell created
Sep 9 '07 #19

gits
Expert Mod 5K+
P: 5,352
hi ...

please have a look at the correct usage of the code-tags:

[CODE=javascript] code goes here [/code]

kind regards
Sep 9 '07 #20

P: 11
[quote=Leena P]i want to basically take some information for the product and let the user
enter the the material required to make this product
Oct 9 '07 #21

acoder
Expert Mod 15k+
P: 16,027
Thanks
my onchange event function works in select option
but then it gives me error in mozilla

Error: uncaught exception: [Exception... "Node cannot be inserted at the specified point in the hierarchy" code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"

this is in the add_rows function
when i try to append

Expand|Select|Wrap|Line Numbers
  1. tdObj.appendChild(create_object(tabCols[i],col_names[i]+'['+j+']'));
  2. trObj.appendChild(tdObj); }
  3. obj.firstChild.appendChild(trObj); //this line the above error occurs
  4.  
You're trying to append to a whitespace node. Don't use firstChild. Use a tbody and append to that instead.
Oct 9 '07 #22

Post your reply

Sign in to post your reply or Sign up for a free account.