I want to display record of the selected month from drop down. I have a function for which a variable inside this function has to pick selected month from a different function.
I am using getElementById().value
to read value from the other function. My application has 3 levels.
Level 1 is very generic, level 2 is classified and level 3 is very specific(further classified from level 2). I'll select month from level 1 and level 2, level 3 should display corresponding data. Level 2 works fine by reading getElementById("month").value
from level 1 but level 3 is not reading getElementById("month").value
from level 1. Below is my code
function level_1() {
var cur_month = new Date.today().toString("MM");
cur_month=cur_month.trim();
var sel_month = "";
try{
sel_month=document.getElementById("month_ps").value;
cur_month = sel_month;
} catch(err){
sel_month=cur_month;
}
var display = "<div style='color: ffff00'>Month: <select name='month_ps' id='month_ps' value= '"+cur_month+"' style='font-weight: bold' onChange='level_1()'>";
var output = <input type='radio' name='level1' onClick='level2()'>
}
function level_2(){
var cur_month = new Date.today().toString("MM");
cur_month=cur_month.trim();
var sel_month = "";
try{
sel_month=document.getElementById("month_ps").value;
cur_month = sel_month;
} catch(err){
sel_month=cur_month;
}
var output = <input type='radio' name='level2' onClick='level3()'>
}
function level_3(){
var cur_month = new Date.today().toString("MM");
cur_month=cur_month.trim();
var sel_month = "";
try{
sel_month=document.getElementById("month_ps").value;
cur_month = sel_month;
} catch(err){
sel_month=cur_month;
}
}