ASA2k ASA2k - 1 year ago 70
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.

Answer Source

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>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download