Image preview not working in IE7.Please help
Hi,
I have an application that opens a file dialog. You can select an image and after that you can see it in a preview image tag.
The preview images on client side works fine in IE6, but not IE7.
This preview does not need postback to the server .
Can this script work in IE 7?
<script language="javascript" type="text/javascript">
function ChangeLogo(obj)
{
if (obj != null)
{
var img = document.getElementById("imgLogo");
if (img != null)
{
img.src = obj.value;
}
}
}
</script>...
<asp:Image ID="imgLogo" BorderWidth="1px" BorderColor="CornflowerBlue" ImageUrl="~/images/empty_logo.jpg" Width="60px" runat="server" />
<asp:FileUpload OnChange="ChangeLogo(this);" BorderColor="CornflowerBlue" ID="fuLogo" Width="170px" />
The code above is working in IE 6.But not in IE 7.
So used the code below.But the image is still not displayed in IE 7.
The code snippet I used is:
<script type="text/javascript" language="javascript">
function ChangeLogo(obj)
{
document.getElementById("<%=imgPhoto.ClientID %>").style.visibility='visible';vbvbvbif (obj != null)
{
var img = document.getElementById("<%=imgPhoto.ClientID %>");
if (img != null)
{
alert(obj.value);
img.setAttribute("ImageUrl",obj.value);
}
}
}
</script>
<body>
<asp:Image ID="imgPhoto" runat="server" Width="100px" Height="100px" style="visibility:hidden" />
<asp:FileUpload ID="filePhoto" runat="server" onchange="javascript:ChangeLogo(this);" />
</body>
Then also image is not displyed.What shall i do?
I want to show image preview in my page.Please give a solution for this issue..
Thank You,
Subhashni Palanivel.
|