文件上传控制和 GWT 外观 [英] File Upload Control and GWT Look and Feel

查看:36
本文介绍了文件上传控制和 GWT 外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写我的第一个 GWT 项目.我有一个带有标签、文件上传控件和上传按钮的表单,但它们在各种 Web 浏览器中看起来很糟糕而且差别很大.此外,文件上传控件中的按钮与 GWT 按钮控件的样式不同.另一个问题是,在 Chrome 中,文件选择按钮在左侧?!?

I'm writing my first GWT project. I have a form with label, file upload control and upload button but they look awful and too different in various web browsers. Also button from file upload control doesn't have the same style like GWT button control. And the other problem is that in Chrome Button for file choose is on the left?!?

我能做些什么?

Internet Explorer 中上传文件:

Firefox 中上传文件:

Chrome 中上传文件:

推荐答案

在不同的浏览器中看起来会有所不同.这是他们和我们必须忍受的方式.

The <input type="file"> WILL look different in different browsers. This is the way they and we have to live with it.

但我不认为这是真正需要担心的事情.如果有人选择使用浏览器,他们会根据浏览器的外观来决定工作,其中包括 .

But I don't think this is something to really worry about. If someone chooses to work with a browser, they decide the work with the browser's look and feel, which includes the rendering of <input type="file">.

也无法更改此控件的按钮样式(以体面/干净的方式).

It is also not possible to change the button styles of this control (in a decent/clean manner).

在我看来,您可以让它们保持原样.对我来说,系统(浏览器)而非程序员拥有的某种系统控件.您也无法决定显示哪些文件以及不显示哪些文件(例如,过滤并显示.doc"和.docx",其他的都无法实现)

In my opinion you can leave them the way they are. For me the <input type="file"> is some sort of a system control owned by the system (the browser), and not the programmer. You cannot also decide which files to display and what not to (eg., filter and display ".doc" and ".docx" and nothing else is not possible)

如果由于某种原因你真的真的需要一个统一的界面:一些网站使用一个按钮的图片并使用 flash 来显示文件打开框.不过,这依赖于闪存的存在.我记得(2 年前的记忆)在 YUI 中有一个控件用于这种文件输入(基于 flash),也许 GWT 中也有类似的控件.不过我不是很确定.

If for some reason you really really need a single uniform interface: some websites use a picture of a button and use flash to display the file open box. This relies on the presence of flash though. I remember (2 years old memory) there was a control in YUI for this kind of file input (based on flash), perhaps there is a similar one in GWT. I am not very sure though.

这篇关于文件上传控制和 GWT 外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆