Code Snippet </> Info
Snippet Name: Hide Red X in Internet Explorer
Description: Hide the red X in Internet Explorer when you have empty image fields in a Web App.
Compatible Browsers:
Note: The code will not cause any issues with other browsers... they will ignore this code snippet and show the image as intended.
Author: SnapBuilder <snippets@snapbuilder.com>
Last Modified: 2019-12-09 02:52:01
Language: javascript
Highlight Mode: javascript
|
Copy Codes: Use Free Notepad ++ |
|
Snap HTML Code Editor: Paste the source code, make changes and instantly see it in live preview. Snap HTML Code Editor
|
|
Copied To Clipboard!
<html>
<head>
<title>Hide Red X in Internet Explorer Javascript Code Snippet</title>
<script>
<!--
// Begin Hide Red X in Internet Explorer
// == This Script Free To Use Providing This Notice Remains == //
// == This Script Has Been Found In The https://snapbuilder.com Free Public Codes Library == //
// == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == //
-->
function ImageLoadFailed() {
window.event.srcElement.style.display = "None";
}
</script>
</head>
<body>
<p>Hiding the red X displayed by Internet Explorer when you have empty image fields in a Web App</p>
<p>Append your image paths with this code: OnError="ImageLoadFailed()"</p>
<p><img src="http://your_domain.com/images/image_name.jpg" OnError="ImageLoadFailed()" alt="My Image" /></p>
</body>
</html>
|