试试<html:select name="Form" property="Typ" onchange="showElement(this)" >
<option value="1">1 </option>
<option value="2">2 </option>
</select>
<DIV ID="DIV1" style="display:none">
<html:text name="Form" property="Nm"/>
</DIV>
<script>
function showElement(obj)
{
document.getElementById("DIV1").style.display=((obj.value=="1")?"none":"")
}
</script>
<option value="1">1 </option>
<option value="2">2 </option>
</select>
<DIV ID="DIV1" style="display:none">
<html:text name="Form" property="Nm"/>
</DIV>
<script>
function showElement(obj)
{
document.getElementById("DIV1").style.display=((obj.value=="1")?"none":"")
}
</script>
但一般来讲不推荐使用onchange来获得select元素的值改变事件
因为:
IE仅当select失去焦点是才触发onchange,而FF会在值改变之后马上触发。
所以:
用select的onclick事件,判断值是否改变比较好