|
Yes, you are absolutely right.
The script is now working perfectly in IE and Firefox.
Thank you for your help.
Here is the final working version.
<script type="text/javascript">
function checkField()
{
var val = document.getElementById('ClassType').value;
if(val=='C') {
show('divClass');
hide('divWorkshop');
}
else {
show('divWorkshop');
hide('divClass');
}
}
function hide(obj)
{
var obj1 = document.getElementById(obj);
obj1.style.display = 'none';
}
function show(obj)
{
var obj1 = document.getElementById(obj);
obj1.style.display = 'block';
}
</script>
<body onload=checkField();>
/* Field1 - is a drop down list */
<select name="ClassType" id = "ClassType" size="1" onchange="checkField(this.value)">
...
</select>
/* Field2 */
<div id="divClass">
...
</div>
/* Field 3 */
<div id="divWorkshop">
...
</div>
|