【发布时间】:2019-02-19 09:34:49
【问题描述】:
当点击默认照片时,它应该让用户从他的计算机中选择一个文件,而不是创建一个input type = "file",这使得用户首先点击浏览按钮而不是选择一个文件。用户应该直接点击默认照片,然后会出现一个文件选择窗口。
<html lang = "en">
<head>
<title>
Profile Click
</title>
<style>
#file{
display: none;
}
</style>
</head>
<body>
<script>
function pro1(){
document.prolis.getElementById("image") = document.prolis.getElementById("file");
}
</script>
<form name = "prolis">
<img src = "index.jpg" id = "image" onclick = "pro1()";>
<input type = "file" id = "file">
</body>
</html>
Mozilla Firefox console shows "TypeError: document.prolis.getElementById is not a function".
我应该如何使这个功能发挥作用? 这是我的默认图片:
【问题讨论】:
-
window.prolis
标签: javascript html css function click