[英]Modifying browse button, chrome browser
I've made a form, for uploading an image, it works good on IE,Firefox. 我已经制作了一个表格,用于上传图像,它在IE,Firefox上效果很好。 But on chrome the browse button doesn't work.
但是在Chrome上,浏览按钮不起作用。
This is the browse button: 这是浏览按钮:
<input type="button" name="brw" id="brw" onClick="img.click()" />
When you click this button you fire up img fields browse function. 当您单击此按钮时,将启动img字段浏览功能。
Other fields: 其他领域:
<input name="img" type="file" value="" style="display: none;" onChange="txtFilename.value = this.value;" />
And when you select the image you get images name in this disabled text field. 当您选择图像时,将在此禁用的文本字段中获得图像名称。
<input type="text" name="txtFilename" id="txtFilename" disabled="disabled" />
Any solution for crossbrowser, would save my life :) . 跨浏览器的任何解决方案都可以挽救我的生命:)。 Thx all.
谢谢。
Look here and here (second answer). 看这里和这里 (第二个答案)。 Input of file type cannot be hidden, by setting
display: none
you have to hide it in another way. 通过设置
display: none
无法隐藏文件类型的输入display: none
您无需以其他方式隐藏它。 In my example I set visibility: hidden
or you can play with opacity (like in the other answer). 在我的示例中,我设置了“
visibility: hidden
或者您可以不透明地播放(就像其他答案一样)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.