代言2017-07-05 10:51:31
親,這個好辦,你綁定p click事件,再click 隱藏的input[file]的輸入框!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<script>
function showResurce() {
document.getElementById('resurce').click();
}
</script>
</head>
<body>
<p onclick="showResurce()">点我</p>
<input id="resurce" type="file" style="display: none">
</body>
</html>