Friday, 9 September 2011

Java Script : Drop Down values in JAVA SCRIPT

Hello , This function will help you to find the combo box / drop down box values in java script and again set these values to FORM.

function setVal()
{
alert("sdf");
var innerData=document.getElementById('totData').innerHTML;
var hdtit=document.getElementById('hdsubtit').value;
var hdvalue=document.getElementById('hdsubval').value;
alert(hdtit);
//Getting Selected Index
var v=document.frmSubject.ddsub.selectedIndex;
//Getting Text & Value
var textdata=document.frmSubject.ddsub.options[v].text;
var val=document.frmSubject.ddsub.options[v].value;
//set the value to Form hidden Field
document.frmSubject.hdsubtit.value=hdtit+","+textdata;
document.frmSubject.hdsubval.value=hdvalue+","+val;
if(hdvalue==0){
document.getElementById('totData').innerHTML=innerData+" "+textdata;
}else{
document.getElementById('totData').innerHTML=innerData+" "+textdata;
}
}




Any Quries ....?

You may contact.