gpt4 book ai didi

javascript - 为什么这个按钮不能删除这个图像

转载 作者:行者123 更新时间:2023-11-30 11:40:09 30 4
gpt4 key购买 nike

<分区>

我正在尝试练习编码。我创建了一个实验性网页。我这里有一张我的脸的照片。我在下方放置了一个按钮,通过将图片的显示属性设置为“无”来删除我的图片。但是,我尝试的任何事情似乎都不起作用。为什么是这样?这是我所有的代码,因为我不知道问题出在哪里。

<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>
body
{
background-color: wheat;

}

.name:hover
{
background-color: aquamarine;
}


h1 {
width: 500px;
border: 20px outset brown;
padding: 20px;
background-color: gold;
color: goldenrod;
text-align: center;
margin: auto;
}

img {
height: 500px;
border: 2px solid black;
}
</style>
</head>
<body>
<h1>DENNIS MARKHAM'S FUNSITE</h1>
<br>
<p>Hi, this is <span class = "name"> Dennis</span>, and I'm creating this website just for fun. And
I guess for practice too.</p>
<p>As you can see, my name highlights when you scroll over it. Isn't that cool?
Well I think it is. </p>
<p>I think this could use a background image to give it a more...woody look.
But the problem is I don't understand shit about background images. That's a problem indeed.
</p>
<p>Oh well, let's do a picture:</p>
<br>
<img id = "me" src ='IMG_1742.jpg' alt='my face'>
<br>
<script type = "text/javascript">
function remove(){
document.getElementsById("me").style.display = "none";

//not sure why this doesn't work, but okay
}
</script>
<button type="button" OnClick="remove()">Remove Picture</button>


</body>

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com