<%@ page language="C#" autoeventwireup="true" inherits="_xt3u, gj_web" enableviewstatemac="false" enableEventValidation="false" %>
<html>
<head><title>无标题页</title>
<script type="text/javascript" language="javascript">
var CanUploadExt ="|.jpg|.gif|.bmp|.png|.jpeg|.flv|";
function CheckExt(){
var oFile = document.getElementById('<%=FileUpload1.ClientID %>');var ext = oFile.value.substr(oFile.value.lastIndexOf("."));if(ext.length < 1){parent.xs("请选择要上传的文件。");return false;
}else{ext = ext.toLowerCase();if(CanUploadExt.indexOf("|" + ext + "|") == -1){parent.xs("请选择类似如下后缀名的文件:\r\n" + CanUploadExt);return false;}}return true;}

function IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone","SymbianOS", "Windows Phone","iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false; break;
}}return flag;
}

function sc(){
//__doPostBack('lbupload','');
if(!IsPC()){//alert("手机");
document.getElementById('xs1').style.display="none";
document.getElementById('<%=FileUpload1.ClientID %>').className="none";
var lj=document.getElementById('<%=FileUpload1.ClientID %>').value;
if(lj!=""){
document.getElementById('<%=FileUpload1.ClientID %>').style.display="none";
document.getElementById('xs2').style.display="";
}
__doPostBack('lbupload','');
}else{__doPostBack('lbupload','');}
//document.getElementById('lbupload').click();
window.returnValue=0;//防刷新
}
</script>
<style>.but{cursor:pointer;height:25px;width:120px;text-align:center;line-height:25px;font-size:12px;border:#555555 0px solid;background:#ffffff;color:red;}
.sck{opacity:0;outline:0; border:0px;filter:alpha(opacity=0);position:absolute;font-size:100px;top:0;left:0;width:100px;margin:0px;padding:0px;cursor:pointer;}
</style>
</head><body style="margin:0px;padding:0px;margin-left:auto; margin-right:auto;"><form id="form1" runat="server">
<div style="text-align:center;line-height:25px;font-size:12px;cursor:pointer;width:120px;" id="xs1">浏览并上传</div>
<asp:FileUpload ID="FileUpload1" runat="server" class="sck" Onchange="sc();"/> 
<div style="display:none;" id="xs2"><asp:LinkButton ID="lbupload" runat=server OnClick="Button1_Click"></asp:LinkButton><asp:Button ID="Button1" runat="server" Text="手动点击上传" OnClick="Button1_Click" OnClientClick="return CheckExt()" class="but"/></div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</form>
<script language="javascript">  
<!--  
function __doPostBack_Ex(eventTarget, eventArgument)   
{  
var theform;  
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {  
theform = document.forms[0];  
}  
else {  
theform = document.forms[0];  
}  

if(!theform.__EVENTTARGET)  
{   
theform.appendChild(document.createElement("<input type='hidden' name='__EVENTTARGET'>"));  
}  

if(!theform.__EVENTARGUMENT)  
{   
theform.appendChild(document.createElement("<input type='hidden' name='__EVENTARGUMENT'>"));   
}  

theform.__EVENTTARGET.value = eventTarget.split("$").join(":");  
theform.__EVENTARGUMENT.value = eventArgument;  
if ((typeof(theform.onsubmit) == "function"))   
{  
if(theform.onsubmit()!=false)  
{  
theform.submit();   
}  
}  
else  
{   
theform.submit();   
}  

function __doPostBack(eventTarget, eventArgument)  
{  
__doPostBack_Ex(eventTarget, eventArgument);  
}  


}  
// -->  
</script> 

</body></html>