ModalPopupExtender with thmbnail (problem in javascript)
- by arny
this is the code,it is not working in Firefox,Chrome,to show full size image unless user click on image for couple of times, I basically replace the thmbnail image with full size image in javascript,
here is my code,
TransitionDuration="50" FramesPerSecond="40" RequireOpenedPane="false" SelectedIndex="-1" SuppressHeaderPostbacks="true" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" OnItemDataBound="Accordion1_ItemDataBound" OnItemCommand="Accordion1_ItemCommand"
'
'
Width="90px" Height="70px" onclick="togglePopupImage2(this);" CssClass="thumbnail"
BorderColor="Navy" BorderStyle="Solid" BorderWidth="1"
<table>
<tr>
<td style="background-color: #2E4d7B; height: 15px; color: White; font: arial bold 12px;
padding: 5px">
<label id="imgText" runat="server">
</label>
</td>
</tr>
<tr>
<td>
<asp:Image ID="imgPopup" CssClass="imgpopup" runat="server" />
</td>
</tr>
<tr>
<td align="center" style="background-color: #2E4d7B; height: 25px;">
<asp:Button ID="btnCancel" runat="server" Text="Close" CssClass="closeimage"/>
</td>
</tr>
</table>
</asp:Panel>
And javascript code:
function togglePopupImage2(thumbnail2) {
var imageurl = thumbnail2.src;
var temp = new Array();
temp = imageurl.split('.');
var imagepopup = temp[0].substring(0, temp[0].length - 3) + "." + temp[1];
var img = new Image();
img.src = imagepopup;
$get('ctl00_MainContentCPH_UserInterfaceID').style.visibility = 'visible';
$get('ctl00_MainContentCPH_imgPopup').src = img.src;
//alert(img.src);
if (img.width > 750) {
if (screen.width == '1024' || screen.width == '800') {
$get('ctl00_MainContentCPH_imgPopup').width = 550; //to show the picture in 1024 or 800 resolutions
}
else {
$get('ctl00_MainContentCPH_imgPopup').width = 750;
}
}
else {
$get('ctl00_MainContentCPH_imgPopup').width = img.width;
}
if (img.height > 568) {
if (screen.width == '1024' || screen.width == '800') {
$get('ctl00_MainContentCPH_imgPopup').height = 350; //to show the picture in 1024 or 800 resolutions
}
else {
$get('ctl00_MainContentCPH_imgPopup').height = 568;
}
}
else {
$get('ctl00_MainContentCPH_imgPopup').height = img.height;
}
// }
}
Please find the error and let me know what is the right way to achieve this?
Thanks in advance