2013-08-21 123 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; 

}