Create text box vs select drop down in javascript

Hi, today i want to sharing about how to add text box in javascript.. maybe to me it new things... ihii
i found it.. yeay.. althought i think that is difficult but after learn, check and error.. that a little bit easy.. hihi.. here is example of coding.. sharing to all of u who is still searching for the coding.. Hope that will help you all.. :D



select box
    


var cellRight = row.insertCell(2);

        cellRight.align = 'center';

var textbox = document.createElement('input');

        textbox.name = 'selGrade_SPMAdd[]';

        textbox.id = 'selGrade_SPMAdd'+iteration;

        textbox.className = 'required'+'input-small';

        textbox.type = 'text';

        textbox.style = 'text-transform: uppercase';

        textbox.size = '5';

        cellRight.appendChild(textbox); 


select box

    

var cellRight = row.insertCell(2);
  cellRight.align = 'center';
  var el = document.createElement('select');
  el.name = 'selGrade_STPMAdd[]';
  el.id = 'selGrade_STPMAdd'+iteration;
  el.className = 'required'+'input-small';
  el.options[0] = new Option('-Choose Grade-','');
  


el.options[] = new Option('', '');
     0) 
    {
     mysql_data_seek($rsGred, 0);
     $rowGred = mysql_fetch_assoc($rsGred);
    } //---- end if

cellRight.appendChild(el);
    


Why  row.insertCell(2), that is because it at 2nd row..

this an example coding how to add Subject in SPM and STPM.. :D

credit :
http://stackoverflow.com/questions/4766941/dynamically-adding-textboxes-to-a-form-by-the-click-of-a-button
 

0 comments: