Four JS implementation of multiple file upload code (1/2)

Source: Internet
Author: User
Tags eval file upload
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title> multi-File upload </title>
<script language= "Web Effects" >
function AddFile ()
{
var str = ' <input type= "file" size= "name=" file ">"
Document.getelementbyidx (' myfile '). insertAdjacentHTML ("BeforeEnd", str)
}
</script>
<body>
<form id= "Form1" method= "POST" runat= "server" enctype= "Multipart/form-data" >
<div align= "center" >
<p id= "myfile" ><input type= "file" size= "$" name= "file" ></p>
<p>
<input type= "button" value= "Add" onclick= "AddFile ()" >
<input onclick= "This.form.reset ()" type= "button" value= "Reset" >
<asp Tutorial: Button runat= "Server" text= "Start uploading" id= "Uploadbutton" ></asp:button>
</p>
<p>
<asp:label id= "strstatus" runat= "server" font-names= "Arial" font-bold= "true" font-size= "9pt"
Width= "500px" borderstyle= "None" bordercolor= "White" ></asp:label>
</p>
</div>
</form>
</body>

Method Two

<title> multi-File upload </title>

<style>

. lbtn

. ist

</style>


<script language= "JavaScript" >

function Check ()
{
var icnt = Document.frm1.cnt.value
var name;
for (i=0;i<icnt;i++)
{
Name = eval ("Document.frm1.name" +i+ ". Value");
if (Name==null | | name== "")
{
var num = i+1;
Alert ("The first" +num+ "blank, please fill in the content");
Break
}
}
if (i==icnt)
{
Document.frm1.submit ();

Document.body.innerhtml= "Uploading Please wait!.... www.111cn.net";
}
}


var i=0;

Function Show (obj,i)
{
var str;
var name;
var value;
var Xa=this.value;
str = Obj.value;
Name = Str.split ("");
Name = Name.pop ();
Name = Name.split (".");
value = Document.frm1;
Value = Value.name (i);
Document.frm1.cnt.value = name[0];
alert (Document.frm1.name33.value);
Eval ("Alert (document.frm1.name" +i+ ". Value)");
Eval ("Document.frm1.name" +i+ ". value=name[0]");
return 1;
}


function Create ()
{
var sfrm = document.frm1.innerhtml;

var icnt = Cnt.value;

var num;

for (j=0;j<icnt;j++)

{
num=i+1;
if (Num < 10)
{
num= "0" +num;
}
SFRM = sfrm + "Please select File" +num+ "<input type=file name= ' file" +i+ "' onchange= ' show (This," +i+ ") ' class=ist> ';

SFRM = sfrm + "song name: <input type=text name= ' name" +i+ "' value= '" class=ist> ";

SFRM = sfrm + "<br>";

i++;

}

document.frm1.innerhtml = sfrm;

Document.frm1.cnt.value=i;

}


</script>


<body class=lbtn onload= "Document.frm1.cnt.value=cnt.value;" >

Please enter the number of files to upload: <input type=text name=cnt value= "class=ist onchange=" "Document.frm1.cnt.value=this.value;" >

<input Type=button name=bt1 value= "Generate Upload File box" onclick= "Create ();" Class=lbtn><p><center>

<input Type=button name=bt1 value= "Upload" onclick= "check ();" Class=lbtn> &nbsp;&nbsp;

<input Type=button name=bt1 value= "Clear onclick=" document.location.reload (); "Class=lbtn>


<form id= "Frm1" Name=frm1 method= "Post enctype=" Multipart/form-data "action="./upload.php Tutorials ">

<input Type=hidden name=cnt value= "Ten" class=ist>

</form>


<input Type=button name=bt1 value= "Upload" onclick= "check ();" Class=lbtn> &nbsp;&nbsp;

<input Type=button name=bt1 value= "Clear onclick=" document.location.reload (); "Class=lbtn>

</body>

<form id= "Frm1" Name=frm1 method= "post" enctype= "Multipart/form-data" action= "./upload.php" >

<input Type=hidden name=cnt value= "Ten" class=ist>

</form>


<input Type=button name=bt1 value= "Upload" onclick= "check ();" Class=lbtn> &nbsp;&nbsp;

<input Type=button name=bt1 value= "Clear onclick=" document.location.reload (); "Class=lbtn>

</body>

Home 1 2 last page

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.