see jsbin
if u seen my jsbin then i have two table hardcode table and dynamic table.
i have to create dyanamic table exactly like hardcode table.
i have a problem in hour coloumn how do i loop through table to exactly create hour coloumn like hardcode table.
for (var i = 1; i < parseFloat(timeSlot); i++)
{
row = tableAppointment.insertRow(i);
cell1 = row.insertCell(0);
cell1.className += 'csstablelisttd';
cell2 = row.insertCell(1);
cell2.className += 'csstablelisttd';
cell3 = row.insertCell(2);
cell3.className += 'csstablelisttd';
cell1.innerHTML = startTime;
cell2.innerHTML = parseFloat(constMinutes);
constMinutes = parseFloat(constMinutes + 15);
if (constMinutes == "60")
{
constMinutes = 0;
}
}
Do you mean like this?
I’ve modified the lines where it sets the
cell1.innerHTMLEDIT:
To the proper AM or PM, I set up an integer that increments and uses the modulus operator. This way it will only ever be 0 or 1 as it increments. I increment it every time we hit 12. It then grabs the text from an array (either AMPM[0] or AMPM[1]).