UI

2010-12-08 47 views
2

HIUI

我使用

<input type="file"> 

它在IE,火狐,Chrome和Safari 我想要的東西,可以在所有瀏覽器4同樣產生不同的用戶界面UI。

這可能嗎?

+0

不能直接改變外觀,唯一的辦法是使用複雜的客戶端腳本 - jQuery是做所有的工作適合你,看到埃裏克答案.. – 2010-12-08 09:00:07

+0

@Shadow - 無法使用css/javascript完成它?我不能使用jQuery – Varun 2010-12-08 09:01:54

+0

jQuery *是* JavaScript。它也可以使用CSS,但更復雜。這一個看起來不錯,認爲我甚至用它在過去:http://www.quirksmode.org/dom/inputfile.html – 2010-12-08 09:10:45

回答

0

此所做的工作對我來說:)

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<title>New Page 1</title> 
<style type="text/css"> 
div.fileinputs { 
    position: relative; 
} 

img.fakefile, input.fakefile { 
position: absolute; 
top: 0px; 
left: 0px; 
z-index: 1; 
} 

input.file { 
position: relative; 
text-align: right; 
-moz-opacity:0 ; 
filter:alpha(opacity: 0); 
opacity: 0; 
z-index: 2; 
}</style> 

<script type="text/javascript"> 
function HandleFileButtonClick() 
    {  
    document.getElementById("xyz").value =document.getElementById("abc").value; 
    } 


</script> 
</head> 

<body> 
<div class="fileinputs"> 
    <input type="file" id="abc" class="file" onchange="HandleFileButtonClick();" /> 
     <input type="text" id="xyz" class="fakefile" /> 
     <img src="browse button.bmp" class="fakefile" style="position: absolute; left: 150; top: 0" width="61" height="22"/> 
</div> 
</body> 
</html> 
0

作爲一項安全防範措施,許多瀏覽器(至少是Firefox的最新版本)不允許您再輸入一個文件名。您只能以圖形方式選擇文件。我相信Chrome也是一樣。

你在說什麼樣的用戶界面?如果你的意思是另一種選擇文件的方式......我不認爲有另一種方式(也是安全防範)。