悟心

成功不是将来才有的,而是从决定去做的那一刻起,持续累积而成。 上人生的旅途罢。前途很远,也很暗。然而不要怕。不怕的人的面前才有路。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  93 随笔 :: 1 文章 :: 103 评论 :: 0 Trackbacks
Ext里的Ext.form.FileUploadField只是简单包装了一个 input type为file的对象,这种dom对象是不支持你说的功能的,accept属性不管用.
你说的这个功能目前用flex做最合适,
另外用参照如下方式改写Ext.form.FileUploadField控件也行(这种方式问题很多,推荐用flex,直接去网上下别人写好的swf文件就可以用)
<input type="button" onclick="openfile()" value="Browse" />
function openfile() 

var fd = new ActiveXObject("MSComDlg.CommonDialog"); 
fd.Filter 
= "图像文件 (*.jpg;*.jpeg;*.gif)|*.jpg;*.jpeg;*.gif"
fd.FilterIndex 
= 2;    
fd.MaxFileSize 
= 128
fd.ShowOpen(); 
document.getElementById(
"txtFileName").value = fd.Filename; 
document.getElementById(
"textImage").src = fd.FileName; 

</script>
posted on 2010-08-29 16:02 艾波 阅读(3457) 评论(0)  编辑  收藏 所属分类: Extjs

只有注册用户登录后才能发表评论。


网站导航: