View Single Post
Old 07-06-2011, 01:14 PM   PM User | #7
CoffeeBreak21
New to the CF scene

 
Join Date: Jul 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
CoffeeBreak21 is an unknown quantity at this point
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>
CoffeeBreak21 is offline   Reply With Quote