<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<style>
img {
height: 150px;
width: 150px;
border-radius: 50%;
object-fit: cover;
background-color: #dfdfdf;
}
</style>
<body>
<img src="./images/头像注册.jpg" alt="">
<input type="file" name="" id="">
<script>
const image = document.querySelector("img");
const input = document.querySelector("input");
input.addEventListener("change", () => {
image.src = URL.createObjectURL(input.files[0]);
});
</script>
</body>
</html>