[英]drop down list changed
in my application I need to check if a drop down list has changed or not. 在我的应用程序中,我需要检查下拉列表是否已更改。 can you please let me know how I should write it?
你能让我知道我应该怎么写吗?
if (document.form.dropdownlist.???)
I don't know what to write instead of ???? 我不知道该写些什么?
You could give this dropdownlist an unique id: 您可以为该下拉列表提供唯一的ID:
<select name="foo" id="foo">
...
</select>
and then subscribe for the onchange
event (make sure you make the subscription once the DOM is loaded, for example in the body onload method): 然后订阅
onchange
事件(确保在DOM加载后立即进行订阅,例如在body onload方法中):
var ddl = document.getElementById('foo');
ddl.onchange = function() {
alert('the value has changed');
};
var count=3;
function check()
{
var obj =new Array();
obj=document.getElementById("list");
checkLength(obj.length);
}
function checkLength(len)
{
if(len>count)
{
alert("Drop down size changed");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.