如何让<input type="file">只显示按钮 不要显示文本路径?

<!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>
</head>
 
<body>
<div style=" height:0px; overflow:hidden; position:absolute;">
<input type="file" id="up" /></div>
<button οnclick="document.getElementById('up').click();">上传</button>
</body>
</html>

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据你提供的代码,我发现了一些问题。 1. 首先,你需要确保在调用 `selectCell` 函数之前已经定义了该函数。根据你的代码,函数定义已经在 `<script>` 标签中给出,所以这一点是正确的。 2. 你在代码中提到了 `table` 变量和 `imageColumnIndices` 数组,但是在你的代码中没有找到相关的使用。请确保这些变量和数组在使用之前已经正确定义和初始化。 3. 在 HTML 代码中添加图片的输入框之后,你在 `<td>` 标签中添加了一个 `<td input type="text" name="determination_rule">Particle</td>` 的标签,它不是有效的 HTML 语法。如果你想在表格中添加文本内容,请使用 `<td>` 标签,并在其中添加文本。 综上所述,以下是你提供的代码的修正版本: ```html <table id="myTable"> <tbody> <tr> <td><input type="file" name="image1_path" onchange="previewImage(this); selectCell(this)" onclick="showPopup(this.src)" style="width: 100px; height: auto;"></td> <td><input type="file" name="image2_path" onchange="previewImage(this); selectCell(this)" onclick="showPopup(this.src)" style="width: 100px; height: auto;"></td> <td><input type="file" name="image3_path" onchange="previewImage(this); selectCell(this)" onclick="showPopup(this.src)" style="width: 100px; height: auto;"></td> <td><input type="file" name="image4_path" onchange="previewImage(this); selectCell(this)" onclick="showPopup(this.src)" style="width: 100px; height: auto;"></td> <td><input type="file" name="image5_path" onchange="previewImage(this); selectCell(this)" onclick="showPopup(this.src)" style="width: 100px; height: auto;"></td> <td>Particle</td> </tr> </tbody> </table> <button type="submit">提交</button> <script> function selectCell(element) { // 获取选中的单元格或执行其他操作 var cellElement = element.parentNode; // 获取选择的图片路径 var imagePath = element.value; // 在单元格中显示图片 var imgElement = document.createElement("img"); imgElement.src = imagePath; cellElement.appendChild(imgElement); } </script> ``` 请注意,以上修正版本仅仅是根据你提供的代码进行了修改。如果你还有其他需求或问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值