analysis of the function principle of NetEase mailbox Add accessory
Personal feel NetEase Mailbox Add accessory function is cool, the two days online under the network research. Some of the experience written out, lest forget.
All originated from type file input, which is nothing to say (this thing is very mysterious). Why the NetEase page did not see this thing. Look below:
< HTML >
< head >
< title > Upload Control demo </title >
< BODY >
< input type = "file" id = "F1" style = "display:none;" />
< input type = "button" onclick = "f1.click ();" Value = "File browse"/>
</Body >
</HTML >
As you can see, you can't see it, but it also opens the File navigation box.
Made the NetEase effect?
<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Test.aspx.cs" Inherits = "Mytest_test"%> ;
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< title > Upload Control demo </title >
< BODY >
< form ID = "Form1" runat = "server" >
< input type = "File" name = "f1" id = "F1" runat = "server"/>
< input type = "button" value = "Browse file" name = "cbtn" onclick = "f1.click ();" />
< Asp:button ID = "submit" runat = "server" OnClick = "button1_click1" Text = "Save"/>
</form >
</Body >
</HTML >
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class Mytest_test:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Button1_click1 (object sender, EventArgs e)
{
Response.Write ("Number of uploaded files:" + Request.Files.Count.ToString ());
}
}
As above: Click F1 after click Submit, there is a file uploaded to the service side. Click Cbtn after click Submit, even submit action is not.
In the client's view: Click F1 or click Cbtn after the page performance is no different.
Online explanation: The security mechanism of the browser.
Key points to upload files: (1) must have a mouse click, (2) must be clicked on the Upload Control button on the navigation.
Implementations similar to 163:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Test.aspx.cs" Inherits = "Mytest_test"%> ;
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head ID = "Head1" runat = "server" >
< title > 163 upload </title >
< style type = "Text/css" >
A.addfile {
Background-image:url (http://p.mail.163.com/js31style/lib/0703131650/163blue/f1.gif);
Background-repeat:no-repeat;
Background-position: -915px-17px;
Display:block;
Float:left;
height:20px;
Margin-top: -1px;
position:relative;
Text-decoration:none;
top:0pt;
width:80px;
}
Input.addfile {
Cursor:pointer!important;
height:18px;
Left: -13px;
Filter:alpha (opacity=0);
Position:absolute;
top:5px;
width:1px;
Z-index:-1;
}
</Style >
< BODY >
< form ID = "Form1" runat = "server" >
< div >
< a id = "Container1" class = "AddFile" >
< input ID = "FILE_0" name = "File_0" type = "file" class = "addfile" runat = "server"/>
</a >
</div >
< Asp:button ID = "Button1" runat = "server" Text = "button" OnClick = "Button1_Click"/>
</form >
</Body >
</HTML >
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;