我想要 2 个按钮或只有 2 个标签或喜欢来显示/隐藏 2个图像,但彼此独立。我已经为 1 个图像编码,但如果我在 html 中设置两次,它现在不起作用。请参阅JSFiddle。
HTML:
<html>
<head>
<title></title>
</head>
<body>
<p><img height="600" id="map_img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Hsi-h000.png/600px-Hsi-h000.png" style="display: none;" width="600" /> <input id="Mapred" onclick="showImg()" type="submit" value="Mapred" /></p>
<p><img height="800" id="map_img2" src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Sandro_Botticelli_-_La_nascita_di_Venere_-_Google_Art_Project_-_edited.jpg/800px-Sandro_Botticelli_-_La_nascita_di_Venere_-_Google_Art_Project_-_edited.jpg" style="display: none;" width="502" /> <input id="Map" onclick="showImg2()" type="submit" value="Map" /></p>
</body>
</html>