JS Select RadioButton Drop-down menu check box drop-down list radio button value
Select a value for RadioButton
function Chooseradiovalue (radioname,value)
{
var radio = Document.getelementsbyname (Radioname);
for (var i = 0;i < radio.length;i++)
{
if (Radio[i].value = = value)
Radio[i].checked = true;
}
}
Select the specified value for the Drop-down menu
function Chooseselectvalue (selectname,value)
{
var DDL = oo (selectname);
for (var i = 0;i < ddl.length;i++)
{
if (Ddl.options[i].value = = value)
Ddl.selectedindex = i;
}
}
The specified value selected
function Choosecheckboxvalue (checkboxname,value)
{
if (Value = = ") return;
var ary = Value.split (', ');
var cehckbox = Document.getelementsbyname (checkboxname);
for (var k = 0; k < ary.length;k++)
{
for (var i = 0;i < cehckbox.length;i++)
{
if (Cehckbox[i].value = = Ary[k])
Cehckbox[i].checked = true;
}
}
}
//Get Drop-down list text
function Getselecttext (selectid)
{
try
{
& nbsp; var sel = oo (selectid);
return sel.options[sel.selectedindex].text;
}catch (e) {return "";}
}
//Get Drop-down list value
function Getselectvalue (selectid)
{
try
{
var sel = oo (selectid);
return sel.options[sel.selectedindex].value;
}
catch (E)
{
return "";
}
}
//Get check box value
Function Getcheckboxvalue (chkname)
{
var chk = Document.getelementsbyname (chkname);
var str = "";
for (var i = 0;i < chk.length;i++)
if (chk[i].checked)
& nbsp; str + + Chk[i].value + ",";
if (str!= "") str = STR.SUBSTR (0,str.length-1);
return str;
}
//Get list box value
function Getlistvalue (listid)
{
var sel = oo (listid);
var St r = "";
for (i=0;i<sel.length;i++)
if (sel.options[i].selected)
& nbsp; str + + sel.options[i].value + "|";
if (str!= "") str = STR.SUBSTR (0,str.length-1);
return str;
}
//Get radio button value
function Getradiovalue (radioname)
{
var radio = Document.getelementsbyname ( Radioname);
for (i=0;i<radio.length;i++)
if (radio[i].checked)
return radio[i].value;
return ";
}
//Get radio button object
function Getradioobj ( Radioname)
{
var radio = document.getelementsbyname (radioname);
for (i=0;i<radio.length;i++)
if (radio[i].checked)
return radio[i];
Return "";
}