To close the popped up image when click on , do the following steps:
Create ShowImage.aspx page and add a image control with onclick property like:
asp:Image ID="Image1" runat="server" onclick = "window.open('','_self');window.close();"
And in the page load of ShowImage.aspx do this way:
if (Request.QueryString["image"] != null)
{
Image1.ImageUrl = Request.QueryString["image"];
}
Now, on the parent page write this script:
var Popup;
function popUp(url)
{
Popup = window.open(url, "Popup", 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=100,height=100,left = 490,top = 262');
Popup.focus();
}
function ChangeImg(obj)
{
//Show in popup
var radio = obj.getElementsByTagName("input");
for (var i=0;i less than radio.length;i++)
{
if (radio[i].checked)
{
popUp("ShowImage.aspx?image=images/" + radio[i].value + ".jpg");
}
}
}
Note: Use the general sign for 'Less than' in the for loop. I am unable to publish here because it acts like HTML tags and won't let me go.
Sunday, March 15, 2009
Subscribe to:
Posts (Atom)