我使用此代码重命名输入类型文件浏览按钮,该代码适用于Firefox和Chrome,但它不适用于IE 8 +,有人可以帮我修复此问题或请给我一个替代方法,谢谢
HTML
<input type="button" class="red" id="pseudobutton" value="Attach Photo"/>
<input type="file" name="attachement" class="hide" id="openssme" onmousedown="buttonPush('depressed');" onmouseup="buttonPush('normal');" onmouseout="buttonPush('phased');"/>
CSS
input.hide
{
position:absolute;
left:370px;
-moz-opacity:0;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
JS
<script type="text/javascript">
function buttonPush (buttonStatus)
{
if (buttonStatus == "depressed")
document.getElementById("pseudobutton").style.borderStyle = "inset";
else
document.getElementById("pseudobutton").style.borderStyle = "outset";
}
</script>