ASA2k ASA2k - 2 months ago 5x
HTML Question

How to reference an Image within quotation marks in HTML

I was wondering how to reference an image within quotation marks in HTML.

I have this code:

<input type="button" value="TEXT GOES HERE" onclick="showImage();"/>

And I wish to place an image within the value field. I tried this:

<input type="button" value="this.src='Images/pickups.png'" onclick="showImage();"/>

But instead of displaying the image it simply displays the this.src... as text.


If you want a button, use button html tag, and inside put imgtag with src attribute pointing to your image url

<button type="button"  onclick="showImage();"><img src="favicon.ico"/></button>