I post the solution found
I have put some alert inside if and for cicles to see the value of variables returned:
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[i].text;
newElem.value = db[i].value;
Iss_Chooser.add(newElem, where);
if ((choice == "email1") { alert db[i].value; }
}
alert (newElem.value); and alert on Iss_Chooser value
}
I understood that I could not solve my problem in this way,
because inside the function setIssue(chooser) it is impossible to make an if condition between a db[i] and an option value of the second menu "iss_sum" that I can select only in a following step.
So, looking at the empty value of a variable returned from alert,
I have created, inside the head, a second function called "setLabel()",
recalled in the second menu "iss_sum",
and I solved the problem.
I post now all the code to understand well all the flow:
<head>
<Script Language="JavaScript">
var sum_db = new Object()
sum_db["email1"] = [{value:"I01 - Problemi di primo livello", text:"I01 - Problemi di primo livello"},
{value:"I02 - Problemi RDM", text:"I02 - Problemi RDM"},
{value:"Free Text", text:"Free Text "}];
sum_db["email2"] = [{value:"I03 - Varie", text:"I03 - Varie"}];
//
//
function setIssue(chooser) {
var newElem;
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var Iss_Chooser = chooser.form.elements["iss_sum"];
while (Iss_Chooser.options.length) {
Iss_Chooser.remove(0);
}
var choice = chooser.options[chooser.selectedIndex].value;
var db = sum_db[choice];
if (choice == "email1") {
newElem = document.createElement("option");
newElem.text = "Choose an issue ...";
newElem.value = "Choose Issue ...";
Iss_Chooser.add(newElem, where);
}
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[i].text;
newElem.value = db[i].value;
Iss_Chooser.add(newElem, where);
}
}
//
function setLabel() {
if (document.forms[0].iss_sum.options[document.FrontPage_Form1.iss_sum.selectedIndex].text.match(/^Free/)) {
document.getElementById("label_des").style.display =""; }
else { document.getElementById("label_des").style.display ="none"; }
}//
</script>
</head>
<body>
<form>
<select size="1" name="mess" id="mess" onchange="setIssue(this)">
<option value="email1" selected>email1</option>
<option value="email2">email2</option>
</select>
....
....
<select id="iss_sum" name="iss_sum"
onchange="setLabel()">
<option value="<%=objRS("Issue_Summary")%>" selected><%=objRS("Issue_Summary")%></option>
</select> <label for="iss_des" id="label_des" style="display:none ; vertical-align:top">Description:<textarea id="iss_des" name="iss_des"><%=objRS("Issue_Description")%></textarea>
</label>