当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 用css+js定义input_file元素的样式来兼容FireFox

HTML/XHTML教程
HTML表格标记教程(37):表头的背景图象属性BACKGROUND
HTML表格标记教程(41):表头的宽度和高度属性WIDTH、HEIGHT
HTML表格标记教程(36):表头的背景色属性BGCOLOR
揭开HTML 5工作草稿的神秘面纱
清除网页文字水印的两种简单方法
W3C公布最新的HTML5标准草案
XHTML与CSS的面向对象编程
XHTML三种文件类型声明
通过实例掌握BR和P标签的区别
网页表格或div层在网页中被撑开解决之道
网页设计之网页音乐的实现技巧
XHTML常用标签介绍
HTML网页图片标记
网页表单设计实例技巧五则
HTML网页列表标记学习教程
HTML网页超链接标记
HTML表单标记教程(4):
HTML表单标记教程(5):文字域标记
HTML表单标记教程(2):
HTML表单标记教程(3):输入标记

HTML/XHTML教程 中的 用css+js定义input_file元素的样式来兼容FireFox


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 192 ::
收藏到网摘: n/a

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=gb2312" />
<meta http-equiv="content-language" content="zh-cn" />
<meta name="robots" content="all" />
<meta name="keywords" content="关键字描述" />
<meta name="description" content="站点描述" />
<meta name="author" content="我们,[email protected]" />
<meta name="copyright" content="版权所有" />
<link rel="stylesheet" type="text/css" title="通用样式" href="***.css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="bookmark" href="/favicon.ico" type="image/x-icon" />
<title>css+js定义input的file浏览按钮样式兼容FireFox</title>
<style type="text/css">
<!--
*{ margin:0; padding:0; border:0;}
body{font:12px/130% verdana,geneva,arial,helvetica,sans-serif,宋体; padding:20px;}li{list-style:none;}
.clearfix:after{content:"&nbsp;";display:block;height:0;clear:both;visibility:hidden;}.clearfix{*display:inline-block;}
a:link{ color:#000; text-decoration:none; }
a:visited{ color:#000; text-decoration:none; }
a:hover{ color:#000; text-decoration:none; }
.text{ border:1px solid #999;height:16px; width:300px; font-family:verdana; font-size:12px;padding-top:2px; float:left;margin-right: 5px;}
.file{ width:64px;overflow:hidden; background: url(/img/ll.png); height:20px; *vertical-align:3px; overflow:hidden; float:left;}
#file{ width:0; height:20px;margin-left: -154px;*margin-left:-3px; filter:alpha(opacity=0);-moz-opacity:.0;opacity:0.0; cursor:pointer;}
-->
</style>
</head>
<body>
<input id="text" class="text" type="text"/>
<span class="file"><input id="file" type="file" /></span>
<script type="text/javascript">
<!--
var file = document.getElementById("file");
var text = document.getElementById("text");
file.onchange = type;
function type()
{text.value = file.value;}
-->
</script>
</body>
</html>