【问题标题】:How to make an button which shows an image如何制作显示图像的按钮
【发布时间】:2018-10-18 09:35:38
【问题描述】:

我想制作一个按钮,当用户点击它时会显示一个图像,我想要它用于 HTML:

显示图片

【问题讨论】:

标签: html image button


【解决方案1】:

如果我理解您的问题,您希望仅在用户单击按钮时向用户显示图像。

这可以通过 JavaScript 实现:

<html>

<body>
<img src="/path/to_img" style="display:none" id="myImage"/>
<button type="button" onclick="myImage.style.display='block';">Click me</button>
</body>
</html>

【讨论】:

  • 谢谢丹尼尔。是的,正是我想要的!你知道我是否可以为用户单击按钮后显示的图像设置特定尺寸吗?
  • 可以通过css设置尺寸:width: 100px;高度:120 像素;.
猜你喜欢
  • 1970-01-01
  • 2023-03-11
  • 2023-03-16
  • 2013-05-20
  • 2021-10-14
  • 1970-01-01
  • 2019-09-01
  • 1970-01-01
相关资源
最近更新 更多