怎样用JS控制文件上传时FILE控件内默认的文件类型

JavaScript067

怎样用JS控制文件上传时FILE控件内默认的文件类型,第1张

有两种方式,

1、用fileupload控件在后台判断

FileUpload1.FileContent.Length判断大小,

System.IO.Path.GetExtension(FileUpload1.FileName)获取文件后缀

2、用jquery上传控件,可以直接判断类型和大小

另外js也可以在前台判断文件类型,但不能获取文件大小,需要引用插件

<body>

<div class="order_page clearfix">

  <div class="pager" id="Pagination1">分页1</div>

</div>

<table id="Table" cellpadding="0" cellspacing="0" width="100%"></table>

<div class="order_page clearfix">

  <div class="pager" id="Pagination2">分页2</div>

</div>

<input type="button" onclick="changePag()" value="单击改变分页" />

</body>

  

<script language="JavaScript">

$.fn.Page = function(count,opt,id){

    //--这里最好做一个判断,或者把控件和#Table之间建立关系-- 

 var Page = $(id)

 return Page.each(function(index,id) {//--主要是这里的each进行循环--  

        $(id).Pagination(count,opt)

 })

}

$.fn.Pagination = function(count,opt){

    $(this).text("你输入的count为:"+count+" ,你输入的参数pot为:"+opt)

 //--你的分页实现函数--

}

function changePag(){

 $("#Table").Page("count","opt","#Pagination1,#Pagination2")

 /*  count 这是你写的参数

     opt 你写的参数

  "#Pagination1,#Pagination2"  把#Table的分页控件集合传递过去 

 */

}

</script>

既然没有人发,我就献丑了...

我建议你的分页是用代码生成的...