JavaScript onchange 事件
表单文本域或选择域发生改变时会触发 onchange 事件。
支持该事件的 HTML 标签
, ,
支持该事件的 JavaScript 对象
fileUpload, select, text, textarea
onchange 实例
下面的例子演示了 select 下拉选择列表,当列表内无合适选择项而让用户自定义选择项的效果:
function checkArea(x){
var other_area = document.getElementById( "other_area" );
if(x.value == "other"){
other_area.style.display = "inline";
} else {
other_area.style.display = "none";
}
}
请选择所在地区:
北京
天津
上海
其他
请填写地区:
您可以在下面试试本例子效果(选择 其他 ):
请选择所在地区:北京
天津
上海
其他
请填写地区: