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;
}
}
}

No comments:

Post a Comment

Highly Appreciated your comments