Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello Everyone,

I have a piece of code with a HTML image element. Initially it shows one image and after clicking the button it should show another one.

HTML
<html>
<head>
<title>Untitled Page</title>
    <script language="javascript" type="text/javascript">
<!-- Hide script from non-JavaScript browsers
function Clicked()
{
    document.getElementById("Image1").src = "Bones.bmp";
}
-->
</script>
</head>
<body>
<img alt="N/A" id="Image1" src="Valve.bmp" />
<input id="Button1" type="button" value="button" onclick = "Clicked()"/>
</body>
</html>


Everything is working fine if Bones.bmp actually exist. If i remove Bones.bmp, since there is no source now. Along with showing the alternate text N/A it also shows a little xmark in IE and iPhone Safari. How do i avoid this?
Posted
Updated 17-Sep-12 4:51am
v2
Comments
Sandeep Mewara 17-Sep-12 16:18pm    
I believe that's the standard behaviour for missing images in IE!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900