//开始上传
function StartUpload()
{
//获取表单
var BrowFile=document.getElementById("ThorUploadFileControl");
BrowFile.onchange=null;
document.Form1.action="saveuploadfile.aspx";
document.Form1.submit();
}
function StartUpload()
{
//获取表单
var BrowFile=document.getElementById("ThorUploadFileControl");
BrowFile.onchange=null;
document.Form1.action="saveuploadfile.aspx";
document.Form1.submit();
}
<HTML>
<HEAD>
<title>ThorUploadFlash</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
//获取对象
function init()
{
document.Form1.reset();
var BrowFile=document.getElementById("ThorUploadFileControl");}
//选择一个文件
function BrowAFile()
{
document.Form1.reset();var BrowFile=document.getElementById("ThorUploadFileControl");
BrowFile.onchange=FileSelectChange;
BrowFile.click();
}
//当已经选择了一个文件时
function FileSelectChange()
{
var BrowFile=document.getElementById("ThorUploadFileControl");
window.alert(BrowFile.value);
//需要传递消息给FLASH
}
//开始上传
function StartUpload()
{
//获取表单
var BrowFile=document.getElementById("ThorUploadFileControl");
BrowFile.onchange=null;
document.Form1.action="saveuploadfile.aspx";
document.Form1.submit();
}
</script>
</HEAD>
<body onload="init()">
<a href="JavaScript:BrowAFile()">SelectFileName</a>
|
<a href="JavaScript:StartUpload()">StartUpload</a> <form name="Form1" id="Form1" enctype="multipart/form-data" action="POST">
<INPUT id="ThorUploadFileControl" type="file" name="ThorUploadFileControl">
<INPUT id="button1" name="button1" type="submit" value="submit" >
</form></body>
</HTML>
调用document.Form1.submit();
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ThorUploadFlash</title>
<script language="javascript">function init()
{
document.Form1.reset();}function BrowAFile()
{
document.Form1.reset();var BrowFile=document.getElementById("ThorUploadFileControl");
BrowFile.click();
}function StartUpload()
{
document.Form1.submit();
}
</script>
</HEAD>
<body onload="init()">
<a href="JavaScript:BrowAFile()">SelectFileName</a>
|
<a href="JavaScript:StartUpload()">StartUpload</a> <form name="Form1" id="Form1" enctype="multipart/form-data" action="POST" action="up.php">
<INPUT id="ThorUploadFileControl" type="file" name="ThorUploadFileControl">
<INPUT id="button1" name="button1" type="submit" value="submit" >
</form></body>
</HTML>