更新时间:2023-10-06 09:52:34
您好,
我尝试了一些符合您要求的代码.只需检查一次
Hi,
I tried some code for your requirement.just check this once
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language ="javascript" >
function f2(tid) {
if (tid.value == "third") {
alert("third");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<select id="drplst" onchange ="f2(this)">
<option value ="frst">sdfsdfd</option>
<option value ="scnd">sdgfhgffsdfd</option>
<option value ="third">sdfhgfhsdfd</option>
</select>
</div>
</form>
</body>
</html>
我希望它也对您有用
***的
I hope it works for you too
All the Best
通过修改Murali的代码,我解决了我的问题,如下所示:
Hi,By modifying Murali''s code i solve my problem as follows:
function ErrCurLoc(id) {
var x = id.selectedIndex;
var val = id.options[x].value;
if (val == "Select") {
document.getElementById("spErrCurLoc").style.visibility = "visible";
}
else {
document.getElementById("spErrCurLoc").style.visibility = "hidden";
}
}
<select id="ddlCurLoc" runat="server" önchange="ErrCurLoc(this)"></select>
但是当我使用
But when i use
var val= id.options[x].text;
if (val == "Select")
//code
为什么不起作用?
it does not work why?