如何实现浏览图片的功能? 当你点击type=file的控件流就变成WIN而不WEB,怎么可能还选择时实现其实脚本呢。要么自己写一个控件来实现,要么就在右上角点那个略缩图。你的想法不能实现的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script>function fnPreview() { var ele=event.srcElement; document.getElementById("preview").src="file:///"+ele.value;}</script></head><body><form action="" enctype="multipart/form-data" method="post" name="form1" id="form1"> <table width="100%" border="1" cellspacing="1" cellpadding="3"> <tr> <td><input type="file" name="file" onchange="fnPreview()" /></td> </tr> <tr> <td><img id="preview"/></td> </tr> </table></form></body></html> 楼主的意思如果是预览的意思可以用上面兄弟的代码,如果是换掉那个按钮可以使用下面的<input id=a size=20><input type=button value=选择文件 style="width:100;background-image:url('1.gif')" ><div style="position:absolute;top:15;left:-80;width:150;filter:alpha(opacity=0);" ><input type="file" onpropertychange="a.value=this.value" size=33></div> 问个JavaScript二维数组的问题 表格的显示和隐藏方法 两个问题:1、如何用脚本实现样式表xxx:hover{};2、如何屏蔽IE8的“加速器”(activity) 求一个动态创建Flash对象的正确方法 关于JavaScript的问题 新手求问CSDN的论坛左右框架是怎么实现刷新后又回到主页的 用js设计了一个IE和Firefox兼容的菜单,与大家共享,兼散粉 javascript中判断 输入的是否是数值的函数是哪个? Ctrl+Enter就可提交,代码怎么写 ? 简单的问题 怎样才能真正解决ie和firefox的兼容性问题 JS创建下拉框如何实现页面跳转
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
function fnPreview() {
var ele=event.srcElement;
document.getElementById("preview").src="file:///"+ele.value;
}
</script>
</head><body>
<form action="" enctype="multipart/form-data" method="post" name="form1" id="form1">
<table width="100%" border="1" cellspacing="1" cellpadding="3">
<tr>
<td><input type="file" name="file" onchange="fnPreview()" /></td>
</tr>
<tr>
<td><img id="preview"/></td>
</tr>
</table>
</form>
</body>
</html>
<input id=a size=20><input type=button value=选择文件 style="width:100;background-image:url('1.gif')" >
<div style="position:absolute;top:15;left:-80;width:150;filter:alpha(opacity=0);" >
<input type="file" onpropertychange="a.value=this.value" size=33></div>