B
bradwiseathome
I have code that works in IE 6 but does not work in FireFox 1.0.2, how
can I change it so it works in both browsers?
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function AttributeSelected()
{
var selectVal = document.forms['testspit'].elements['lsbRA'].options;
if (selectVal.value == 'Item1')
{
document.getElementById('text2').style.visibility='visible';
document.getElementById('spnlabel').style.visibility='visible';
}
else
{
document.getElementById('text2').style.visibility='hidden';
document.getElementById('spnlabel').style.visibility='hidden';
}
}
</script>
</head>
<body>
<form name="testspit" method="post" action="">
<div id="divPlace" style="width:90%;left:10px;top:40px">
<select multiple id="lsbRA" onChange="AttributeSelected();" >
<option value="Item1">Item 1</option>
<option value="Item2">Item 2 </option>
</select>
<br/><br/>
<input name="text1" type="text" value="text1" size="20">
<br/><br/>
<span id="spnlabel" style="overflow:hidden">
-
</span>
<span id="spntext" style="overflow:hidden">
<input name="text2" type="text" value="text2" size="20">
</span>
</div>
</body>
</html>
Thanks.
can I change it so it works in both browsers?
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function AttributeSelected()
{
var selectVal = document.forms['testspit'].elements['lsbRA'].options;
if (selectVal.value == 'Item1')
{
document.getElementById('text2').style.visibility='visible';
document.getElementById('spnlabel').style.visibility='visible';
}
else
{
document.getElementById('text2').style.visibility='hidden';
document.getElementById('spnlabel').style.visibility='hidden';
}
}
</script>
</head>
<body>
<form name="testspit" method="post" action="">
<div id="divPlace" style="width:90%;left:10px;top:40px">
<select multiple id="lsbRA" onChange="AttributeSelected();" >
<option value="Item1">Item 1</option>
<option value="Item2">Item 2 </option>
</select>
<br/><br/>
<input name="text1" type="text" value="text1" size="20">
<br/><br/>
<span id="spnlabel" style="overflow:hidden">
-
</span>
<span id="spntext" style="overflow:hidden">
<input name="text2" type="text" value="text2" size="20">
</span>
</div>
</body>
</html>
Thanks.