Jump to content

philtyphil

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by philtyphil

  1.  

    Hello,

    I am trying to delete rows if rowcount > 0. then insert three more rows. That means, each time i click the button, it will compare whether rowcount is greater than 0 or not. If yes, it will delete all the rows and insert three more rows on the fly. If no, it will just insert three more rows.

    Everything is working except when row is greated than 0. When row is greater than 0, it deletes but do not insert rows unless I click the button again.

    <html><body><script>
    function rowinsert(){ var e = 
    document.getElementById("year");var f = 
    document.getElementById("month1"); var strSel = "The Value is: " + 
    e.options[e.selectedIndex].value ; var strSel1 = "The Value is: " + 
    f.options[f.selectedIndex].value ;
    var rowCount = 
    document.getElementById('myTable').rows.length;//alert(rowCount);//document.getElementById("tableId").deleteRow(i 
    -1);
    if (rowCount >0)  { for($del=0; $del<4; 
    $del++){//alert($del);document.getElementById("myTable").deleteRow(0);}
      }
    
    for($row=0; $row<3; $row++){var 
    table=document.getElementById("myTable");var 
    row=table.insertRow($row);var cell1=row.insertCell(0);var 
    cell2=row.insertCell(1);cell1.innerHTML="New1";cell2.innerHTML="New";}}
    </script>
    <div>      <select 
    id="year">        <option 
    value="2013">2013</option>        
    <option 
    value="2012">2012</option>           
    </select>
     <select id="month1" 
    >        <option 
    value="Jan">January</option>        
    <option 
    value="Feb">Feb</option>        
    <option value="Mar">Mar</option>    
    </select>    <br/>    
    <button onClick="rowinsert();">Get Selected 
    Item</button></div>
    
    <table id="myTable" border="1">
    </table></body></html>

    Try to using table tr last

  2. Hi everyone,

     

    First of all I am very relieved to find this community. I am new to PHP and I am very interested in it but  I have a lot to learn and I dont think I could manage without a community like this.

     

    At the moment I am putting together a site where there is a members area. I have successfully managed to do this but I would like for the members area page to load information this is pulled from a MySQL database that is personal to the person that logs in. I am not sure of the terminology but I hope you get the idea. If i can clarify anything just let me know.

     

    thank you guys,

     

    kh1e08

     

    Me To

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.