Link to home
Start Free TrialLog in
Avatar of Moti Mashiah
Moti MashiahFlag for Canada

asked on

Html and asp.net mvc

HI Guys,

I'm showing picture in my html page in this way:

<img src="smiley.gif" alt="There is no picture" width="42" height="42">

Open in new window


The issue I have is when the picture doesn't exist I would like to alt="There is no picture" message.
I'm getting the message but I'm getting also little thumb nail which I don't need.

There is work around it to make just the message to appear in case picture doesn't exist?


Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Moti Mashiah

ASKER

Now the question is how do I do it.

Can you send some code example?

Thanks,
Thank you for the idea.

Here is how I solved it.

var img = document.getElementById("myImg");
img.onerror = function () {
    this.style.display = "none";
}