Ext里的Ext.form.FileUploadField只是簡單包裝了一個 input type為file的對象,這種dom對象是不支持你說的功能的,accept屬性不管用.
你說的這個功能目前用flex做最合適, 另外用參照如下方式改寫Ext.form.FileUploadField控件也行(這種方式問題很多,推薦用flex,直接去網(wǎng)上下別人寫好的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> |
|