用作按钮的图像 HTML
Image to act as a button HTML
你好,我有这个代码:
<!-- Button that triggers the popup -->
<button id="my-button">POP IT UP</button>
<!-- Element to pop up -->
<div id="element_to_pop_up">Content of popup</div>
我有这张图片:
<img src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/>
</a><a href="tecnologia.html">
我想知道如何更改该图像上的 link 以执行与按钮相同的操作,我应该使用什么语法,所以每当我单击图像时它都会触发按钮操作并删除按钮本身
谢谢
您可以使用input type="image"
<input type="image" src="submit.gif" alt="Submit">
<img onclick="document.getElementById('my-button').click()" src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/>
or
<a href="javascript: document.getElementById('my-button').click()"> <img src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/></a>
你好,我有这个代码:
<!-- Button that triggers the popup -->
<button id="my-button">POP IT UP</button>
<!-- Element to pop up -->
<div id="element_to_pop_up">Content of popup</div>
我有这张图片:
<img src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/>
</a><a href="tecnologia.html">
我想知道如何更改该图像上的 link 以执行与按钮相同的操作,我应该使用什么语法,所以每当我单击图像时它都会触发按钮操作并删除按钮本身
谢谢
您可以使用input type="image"
<input type="image" src="submit.gif" alt="Submit">
<img onclick="document.getElementById('my-button').click()" src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/>
or
<a href="javascript: document.getElementById('my-button').click()"> <img src="botones/bannerdiseno_audifonosinpilas.png" width="160" height="33" alt=""/></a>