Wednesday, February 25, 2009

Images changing when clicking the radiobutton on the radiobutton list

If you have a ASP.NET C# form and use a radiobutton list. Suppose there are 4 radiobutton on the list.Default, no images loaded and when click the first radiobutton in the list, it displays a "1.jpg" and when click second radiobutton changes the image and so on...

For this, use the onclick function of the radiobuttonlist.

onclick = "ChangeImg(this);

and try this javascripts:


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 popupvar radio = obj.getElementsByTagName("input");


for (var i=0;i less than radio.length;i++)
{

if (radio[i].checked)
{
popUp("images/" + radio[i].value + ".jpg");break;
}
}
}

Sunday, February 1, 2009

Auto close Popped up images after certain time

If you want to close your pop up image after 10 sec. just follow me:

Add a javascript function to the popup page
function Close()
{
window.close();
}
And to the body tag onload event add this

onload = "setTimeout('Close();', 10000)"

it will close the popup after 10 secs.