IE8 img scr="" displays a red X

  • Thread starter Thread starter christy
  • Start date Start date
C

christy

In my code behind I turn images on and off using the visible attribute. In
IE7 if I set img1.visible = false, the img tag for img1 is removed from the
code, and nothing is shown:
<td align="center">


</td>
the same code in IE8 leaves the img tag in the HML, makes scr="", and the
result is a box with a red X:
<td align="center">
<img id="pg2_V_dgClassList_sec2_row2_img1" src="" align="middle" />
</td>

with both browsers, if the img is visible, the code is the same:
<td align="center">
<img id="pg2_V_dgClassList_sec2_row1_img1"
src="/attention_red.gif" />
</td>
 
to the browser, <img src=""> means load the current url (page) as an
img. in IE8 (as other browsers), if the server response is not a valid
image (which it isn't because its html) it displays as a broken image
(as is proper).

you should make an empty image (say empty.gif), that you img references
when you want it empty.

-- bruce (sqlwork.com)
 
Or double check ? This is suprising as when a control is not visible, it's
html code is not rendered to the browser. I don't see why it would change
with IE8...
 
Thanks Bruce,
That doesn't entirely answer my question though. Why would the code:

img1.visible = false;

in the C# code behind result in different source code in IE8 than IE7
In IE7 when I View Source there is no img tag. In IE8 I get the img tag
with scr="".
 
Back
Top