JavaScript implementation method of adding attachment function _javascript Tips

Source: Internet
Author: User

In the mail we often use to add attachments, now simple application:
Effect Chart:

Implementation principle:
Using table tags, the main idea: the table tag method
1, after clicking on the text, the automatic creation (originally is own/create, now get the Table object, you can InsertRow () InsertCell ()) to create rows and columns
2, delete the time through the parent node to remove
Core code:

function Creatmail () { 
   var Tab=document.getelementbyid ("TabID"); 
   var tr=tab.insertrow ()//Insert row of 
   var Td=tr.insertcell ();//Insert a column of 
   var Td2=tr.insertcell ();//Insert a column 
   Td.innerhtml= "<input type= ' file ' value= ' Select files '/>"; 
   /* 
 
   td2.innerhtml= "<a href= ' javascript:void (0) ' onclick= ' delrows (this) ' > Delete </a> '; 
 * * 
   td2.innerhtml= " '; 
 
  

All the code is as follows (tips: Just implement add only)

<! DOCTYPE html>  

The above is the entire content of this article, sharing the principle of implementation, core code, and we should most like the JavaScript to implement the implementation of add-on features of the lofty code, I hope to help you learn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.