聚光灯看过来请问个JS有关问题,多谢

聚光灯看过来请教个JS问题,谢谢
请教个问题,我想判断一下浏览器,比如是IE 浏览器,我就显示导入上传文件<input type="file">,如果是火狐浏览器,我就显示文本输入路径<input type="text">。怎么做?
------解决思路----------------------
http://www.jb51.net/article/43606.htm

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<script language="JavaScript" type="text/javascript">
function checkFirefoxOrIE(){
userAgent=window.navigator.userAgent.toLowerCase();
var inputDom = document.getElementsByTagName('input')[0];
if(userAgent.indexOf("firefox")>=1){
Findex=userAgent.indexOf("firefox/");
versionName=userAgent.substr(Findex+"Firefox/".length,3);
alert("你用的是火狐浏览器!版本是:Firefox/"+versionName+"<br>");
inputDom.type = "button";

}
else {
var name=navigator.appName;
if(name=="Microsoft Internet Explorer"){
alert("你用的是IE浏览器!");
inputDom.type = "text";
}
else{
alert("你用的不是ie或火狐!");
inputDom.type = "file";
}
}
}
</script>
</head>
<style type="text/css">
input{
height: 20px;
width: 100px;
}
</style>
<body onload="checkFirefoxOrIE()">
<input  >
</body>
</html>