I have the following JavaScript function to display/hide a table row based on a listbox selection.
function clock_Type(id) {
var clockSource = document.getElementById("clockSource");
var clockType = document.getElementById("clockType");
if(id == "1") {
if(navigator.appName == "Microsoft Internet Explorer") {
clockType.style.display = "inline";
clockSource.style.display = "inline";
} else {
clockType.style.display = "table-row";
clockSource.style.display = "table-row";
}
} else {
clockType.style.display = "none";
clockSource.style.display = "none";
}
}
Following is the listbox.
<select id="clck" name="clock" class="selectStyle" style="width: 155px;" onchange="clock_Type(this.value)">
<option value="0">Disabled</option>
<option value="1">Enabled</option>
</select>
This is working fine on the listbox onchange event. i.e. the table row is getting hidden and displayed. But when I try to call the JS function clock_Type() from another function, as shown below, the table row is not getting displayed.
function foo() {
clock_Type(1);
}
When I traced the code the execution reaches the following section for FireFox
clockType.style.display = "table-row";
clockSource.style.display = "table-row";
But the table row is not getting displayed. Any idea what could be the issue here. Thanks in advance!