This article mainly introduces how to add an attachment using javascript. when editing information, we sometimes need to append files and images to implement the upload function. through this article, we will learn how javascript implements the additional function, please read. We often use adding attachments in emails. The following is a simple application:
:
Implementation principle:
Using table labels: using table labels
1. after clicking the text, it will be automatically created (originally self/created. now, after getting the table object, you can create rows and columns in insertRow () insertCell ().
2. the parent node is used to remove the deleted data.
Core code:
Function creatMail () {var tab = document. getElementById ("tabid"); var tr = tab. insertRow (); // insert a line var td = tr. insertCell (); // Insert a column var td2 = tr. insertCell (); // Insert a column of td. innerHTML ="";/* Td2.innerHTML =" delete "; */td2.innerHTML = "";}
All the code is as follows (tips: just implement add)
AddMail.html