Add or remove File Upload Columns

Source: Internet
Author: User
1. [Image]Allows you to add or remove any file upload columns. 2. [Image]Allows you to add or remove any file upload columns.
? 3. [Code] [JavaScript] Code
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> new document </title>
<Meta name = "generator" content = "editplus">
<Meta name = "author" content = "">
<Meta name = "keywords" content = "">
<Meta name = "Description" content = "">
<SCRIPT type = "text/JavaScript" src = "jquery-1.4.4.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
 
VaR addmore = function ()
{
VaR DIV = Document. getelementbyid ("div1 ");
 
VaR BR = Document. createelement ("Br ");
VaR input = Document. createelement ("input ");
VaR button = Document. createelement ("input ");
 
Input. setattribute ("type", "file ");

Button. setattribute ("type", "button ");
Button. setattribute ("value", "Remove ");
 
Button. onclick = function ()
{
Div. removechild (BR );
Div. removechild (input );
Div. removechild (button );
}
 
 
Div. appendchild (BR );
Div. appendchild (input );
Div. appendchild (button );
}
 
/* // Jquery, equivalent implementation
VaR COUNT = 0;
 
$ (Function ()
{
$ ("Input [type = button]"). Click (function ()
Http://www.huiyi8.com/bgm?
VaR BR = $ ("<br>"); background music
VaR input = $ ("<input type = 'file'> ");
VaR button = $ ("<input type = 'button 'value = 'remove" + (++ count) + "'> ");
 
$ ("# Div1"). append (BR). append (input). append (button );
 
Button. Click (function ()
{
BR. Remove ();
Input. Remove ();
Button. Remove ();
});
});
});
 
*/
 
 
</SCRIPT>
 
 
</Head>
 


<Body>

<Input type = "file"> <input type = "button" onclick = "addmore ()" value = "more...">
 
<Div id = "div1"> </div>
 
</Body>
</Html>

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.