上传页不显示进度条
通过设定上传文件个数传文件成功,但不显示进度条,浏览器左下角出现错误提示,大致内容为:file1.value为空或不是对象。把红色代码去掉,不设上传个数,一切正常,请大侠帮忙看看,是咋回事?<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
.STYLE1 {
color: #FF0000;
font-weight: bold;
}
.STYLE3 {color: #FFFFFF; font-weight: bold; }
.STYLE4 {
font-size: 12px
}
.STYLE6 {color: #FF0000}
-->
</style>
</head>
<script language="javascript">
<!--
function ShowProgress() {
var ProgressID = (new Date()).getTime() % 1000000000;
var Form = document.MyForm;
Form.action = "Example_Progress.asp?ProgressID=" + ProgressID;
if (Form.File1.value != "" || Form.File2.value != "" || Form.File3.value != "") {
var Ver = navigator.appVersion;
if (Ver.indexOf("MSIE") > -1 && Ver.substr(Ver.indexOf("MSIE") + 5, 1) > 4) {
window.showModelessDialog("Progress.asp?Count=0&ProgressID=" + ProgressID, null, "dialogWidth=360px; dialogHeight:180px; help:no; status:no");
}
else
{
window.open("Progress.asp?Count=0&ProgressID=" + ProgressID, "_blank", "left=240,top=240,width=360,height=160");
}
return true;
}
else
{
return false;
}
}
//-->
</script>
<body bgcolor="#FFFFFF" text="#000000">
<form onSubmit="return ShowProgress();" action="Example_Progress.asp" enctype="multipart/form-data" method="post" name="MyForm">
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr>
<td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#FFCC00" align="left" valign="middle" height="18" width="67"> 文件上传</td>
</tr>
</table>
<br>
<br>
<table width="680" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#CCCCCC">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#FFFFCC"> <strong>文件上传(<span class="STYLE6">合作愉快,谢谢支持!</span>) </strong></td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="42">
<script language="javascript">
function setid()
{
str='<br>';
if(!window.MyForm.upcount.value)
window.MyForm.upcount.value=2;
for(i=1;i<=window.MyForm.upcount.value;i++)
str+='文件'+i+':<input type="file" name="file'+i+'" style="width:400" class="tx1" value=""><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<li> 需要上传的文件个数
<input type="text" name="upcount" class="tx" value="">
<input type="button" name="Button" class="bt" onClick="setid();" value="· 设定 ·">
</li>
<br>
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="116"><input type="file" name="File1" value="" >
</td>
<tr align="center" valign="middle" bgcolor="#eeeeee"><td bgcolor="#eeeeee" height="24">
<input type="submit" name="Submit" value="· 提交 ·" class="bt">
<input type="reset" name="Submit2" value="· 重执 ·" class="bt"> </td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
setid();
</script>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
.STYLE1 {
color: #FF0000;
font-weight: bold;
}
.STYLE3 {color: #FFFFFF; font-weight: bold; }
.STYLE4 {
font-size: 12px
}
.STYLE6 {color: #FF0000}
-->
</style>
</head>
<script language="javascript">
<!--
function ShowProgress() {
var ProgressID = (new Date()).getTime() % 1000000000;
var Form = document.MyForm;
Form.action = "Example_Progress.asp?ProgressID=" + ProgressID;
if (Form.File1.value != "" || Form.File2.value != "" || Form.File3.value != "") {
var Ver = navigator.appVersion;
if (Ver.indexOf("MSIE") > -1 && Ver.substr(Ver.indexOf("MSIE") + 5, 1) > 4) {
window.showModelessDialog("Progress.asp?Count=0&ProgressID=" + ProgressID, null, "dialogWidth=360px; dialogHeight:180px; help:no; status:no");
}
else
{
window.open("Progress.asp?Count=0&ProgressID=" + ProgressID, "_blank", "left=240,top=240,width=360,height=160");
}
return true;
}
else
{
return false;
}
}
//-->
</script>
<body bgcolor="#FFFFFF" text="#000000">
<form onSubmit="return ShowProgress();" action="Example_Progress.asp" enctype="multipart/form-data" method="post" name="MyForm">
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr>
<td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#FFCC00" align="left" valign="middle" height="18" width="67"> 文件上传</td>
</tr>
</table>
<br>
<br>
<table width="680" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#CCCCCC">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#FFFFCC"> <strong>文件上传(<span class="STYLE6">合作愉快,谢谢支持!</span>) </strong></td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="42">
<script language="javascript">
function setid()
{
str='<br>';
if(!window.MyForm.upcount.value)
window.MyForm.upcount.value=2;
for(i=1;i<=window.MyForm.upcount.value;i++)
str+='文件'+i+':<input type="file" name="file'+i+'" style="width:400" class="tx1" value=""><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<li> 需要上传的文件个数
<input type="text" name="upcount" class="tx" value="">
<input type="button" name="Button" class="bt" onClick="setid();" value="· 设定 ·">
</li>
<br>
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="116"><input type="file" name="File1" value="" >
</td>
<tr align="center" valign="middle" bgcolor="#eeeeee"><td bgcolor="#eeeeee" height="24">
<input type="submit" name="Submit" value="· 提交 ·" class="bt">
<input type="reset" name="Submit2" value="· 重执 ·" class="bt"> </td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
setid();
</script>