2013-08-21 122 views

回答

0

可以使用contentEditable属性上的任何细胞,包括空白单元格:

<td contentEditable> 

Browser support是非常好的。如果使用XHTML语法,请将属性写为contenteditable="true"

该属性需要在您希望编辑的每个单元格上单独设置,除非您想要表格中的所有单元格都是可编辑的,在这种情况下,只需在table属性上设置属性即可。

该问题的第二段涉及其他问题,含糊不清,无法回答,应作为单独的问题发布在描述性标题下。通常,您可以通过几种方式保存用户输入的数据,例如通过JavaScript使用HTML存储(localStorage)或通过Ajax调用或通过表单提交将数据发送到服务器端处理。

0

/** *此方法生成html表格行以插入html文件。 *生成表行后,该方法将在表中的行的端部追加 *占位符,用于插入下一个记录 */ 串generate_student_record_html(INT record_num,INT reg_num, 串nic_num,串student_name,串性别,串father_name) {

string new_record = ""; 
new_record.append("<tr>"); 

new_record.append("<td>"); 
new_record.append(to_string(record_num)); 
new_record.append("</td>"); 

new_record.append("<td>"); 
new_record.append(to_string(reg_num)); 
new_record.append("</td>"); 

new_record.append("<td>"); 
new_record.append(nic_num); 
new_record.append("</td>"); 

new_record.append("<td>"); 
new_record.append(student_name); 
new_record.append("</td>"); 

new_record.append("<td>"); 
new_record.append(gender); 
new_record.append("</td>"); 

new_record.append("<td>"); 
new_record.append(father_name); 
new_record.append("</td>"); 

new_record.append("</tr>"); 
new_record.append(PLACE_HOLDER); // for next record 

return new_record; 

}