How to get selected value of the list box

Hi

All

I am using a list box which is having some options like english, arabic and so on.

When user selects the language, I want to run the java script function which will get the selected value. Here is the code

function changelanguage()
{
var test=document.loginform.s1.selectedIndex.value;

if(var=='en')
{

<?require_once ROOT_PATH . '/language/default/lang_default_full.php'?>;

<?require_once($lan->getLangPath(“full.php”))?>;
}
else
{
<?require_once ROOT_PATH . ‘/language/ar/lang_ar_full.php’?>;
<?require_once($lan->getLangPath(“full.php”))?>;

}

please help me out to solve this problem

Thanks & Regards
MD.Samiuddin

You almost have it, when searching for a selected value within a select box there is an extra method which needs to be used as well and its called options. See how the below goes for you.

var test = document.loginform.s1.options[document.loginform.s1.selectedIndex].value;