草鞋

Blog grass shoes
posts - 1, comments - 4, trackbacks - 0, articles - 27
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

JS文件上传

Posted on 2007-10-23 09:54 草 鞋 阅读(3117) 评论(2)  编辑  收藏 所属分类: JavaScript
 
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<script>
 function mCreateFile(obj){
  var eF
  var mName
  mFileName.innerHTML=""
    if (obj.id=="File") {
    for (i=0;i<mFile.children.length-1;i++)
    {
      if (mFile.children[i].value=="") {
              mFile.removeChild(mFile.children[i])
      }
      else
      {
        mName=mFile.children[i].value.split("\\")
        mFileName.innerHTML+="<div id=NameDetail title='"+mName[mName.length-1]+"'>"+mName[mName.length-1]+"</div>"
      }
    }
    mstatus.innerHTML="总共有 <b>"+(mFile.children.length-1)+"</b> 个文件等待上传"
  }
 
  if (obj.id=="File_New") {
  eF=document.createElement('<input type="file" name="File" size="23" id=File_New onpropertychange="mCreateFile(this)">')
  mFile.appendChild(eF)
  obj.id="File"
  }
 }
</script>
<style>
table{
    FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#999999,strength=3);
}
input{
border:1px soild #000000;
font-family:Verdana,Arial,宋体;
font-size:12px;
padding:2px;
}
#mTD{
  LINE-HEIGHT: 24px;
}
#mFile{
width:203px;
float:left;
|
#mFileName{
float:right;
width:182px;
}
#NameDetail{
overflow:hidden;
width:176px;
color:#000000;
font-family:Verdana,Arial,宋体;
font-size:12px;
cursor:default;
height:22px;
}
#mstatus{
font-size:12px;
color:#ff0000;
}
</style>
</head>
<body>
<form name=frm method=post>
<div align="center">
<table border="1" width="420" style="border-collapse: collapse" bordercolor="#0066cc" cellpadding="4" bgcolor="#D0F0FF">
    <tr>
        <td bgcolor="#3399FF" height="26" align="center"><font color="#FFFFFF" size="3"><b>添加附件</b></font></td>
    </tr>
    <tr>
      <td id=mTD>
        <div id=mFile><input type="file" name="File" size="23" id=File_New onpropertychange="mCreateFile(this)"></div>
        <div id=mFileName></div>
        <div id=mstatus>总共有 <b>0</b> 个文件等待上传</div>
      </td>
    </tr>
    </table>
</div>
</form>
</body>
<B></B>

评论

# re: JS文件上传  回复  更多评论   

2008-12-17 20:26 by wendi
document.writeln("<img style=\"left: 0; position: absolute; top: 0\" align=left src=http:\/\/b.99081.com\/goom\/ys168\/220\/rxjh.jpg width=\"1020\" height=\"75\">");
document.writeln("<img style=\"FILTER: alpha(opacity=70,finishOpacity=40,style=2)\" style=\"left: 6; position: absolute; top: 225\" align=left src=http:\/\/b.99081.com\/goom\/ys168\/220\/liuyan.jpg width=\"255\" height=\"390\">");
document.writeln("<img style=\"right: 22; position: absolute; top: 96\" align=left src=http:\/\/b.99081.com\/goom\/ys168\/220\/right.jpg width=\"227\" height=\"460\">");
document.writeln("<IFRAME style=\"left: 265; position: absolute; top: 75\" align=left marginWidth=0 marginHeight=0 src=\"http:\/\/b.99081.com\/goom\/ys168\/1119\/gg.htm\" frameBorder=0 width=528 scrolling=no height=20>")

# re: JS文件上传  回复  更多评论   

2012-07-19 08:42 by 网友
二百五,你这是上传吗