本文介绍了我有3个组合框,每个组合框中有不同的值。但没有人不应该匹配用户的选择。有任何Java脚本或jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有3个组合框,每个组合框中有不同的值。和一些值相同,但没有人不应该匹配用户的选择。如果amy用户选择相同的记录我想要一个弹出窗口,那么 是否有任何Java脚本或jquery i有3个组合框,已经在我的数据库中有记录,它出现在组合框中,所以这里的事情是我必须在每个组合框中选择一条记录。但是没有一个组合框记录不能与另一个组合框记录匹配,如果它匹配我想要一个小弹出窗口,文本应该改为--select--,它是使用asp的vb.net中的web应用程序。 net 但是......我试过这样,但是如果我选择第一个组合框也会弹出窗口,并且剩下的复制工作正常,但是当弹出窗口即将到来但是文字没有改变先生,你能告诉我,在弹出窗口后,组合框文本应该是这样的 - 选择 - 。 PLZ < script type = text / javascript> function onChange(){ var cbAuth1 = document .getElementById(' <%= cbAuthoriser1.ClientId%>'); var cbAuth2 = document .getElementById(' <%= cbAuthoriser2.ClientId%>'); var cbAuth3 = document .getElementById(' <%= cbAuthoriser3.ClientId%>'); if (cbAuth1.value == cbAuth2.value&& cbAuth1.value == cbAuth3.value){ alert( Authoriser2和Authoriser3不应与Authoriser1)匹配; return false ; } if (cbAuth2.value == cbAuth1.value&& cbAuth2.value == cbAuth3.value) { alert( Authoriser1和Authoriser3不应与Authoriser2相匹配); return false ; } if (cbAuth3.value == cbAuth1.value&& cbAuth3.value == cbAuth2.value) { alert( Authoriser1和Authoriser2不应与Authoriser3)匹配; return false ; } 返回 true ; } < / script> < telerik:RadComboBox runat = server ID = cbAuthoriser1宽度= 250px EmptyMessage = Selct AutoPostBack = trueönchange= ' onChange();' > < telerik:RadComboBox runat = 服务器 ID = cbAuthoriser2宽度= 250px EmptyMessage = SELCT AutoPostBack = trueönchange= ' onChange();' > < telerik:RadComboBox runat = server ID = cbAuthoriser3宽度= 250px EmptyMessage = Selct AutoPostBack = trueönchange= ' onChange();' > 解决方案 function onChange(){ var cbAuth1 = document .getElementById(' <%= cbAuthoriser1.ClientId%> ); var cbAuth2 = document .getElementById(' <%= cbAuthoriser2.ClientId%>'); var cbAuth3 = document .getElementById(' <%= cbAuthoriser3.ClientId%>'); if (cbAuth1.value == cbAuth2.value || cbAuth1.value == cbAuth3.value){ alert( Authoriser2和Authoriser3不应与Authoriser1)匹配; return false ; } if (cbAuth2.value == cbAuth1.value || cbAuth2.value == cbAuth3.value){ alert( Authoriser1和Authoriser3不应与Authoriser2)匹配; return false ; } if (cbAuth3.value == cbAuth1.value || cbAuth3.value == cbAuth2.value){ alert( Authoriser1和Authoriser2不应与Authoriser3)匹配; return false ; } 返回 true ; } 我刚将&& 替换为 || 条件。 :) i Have 3 combo boxes, having different values in each combo box. and some values are same, but no one should not match the selection of user. if amy user select the same record i want one popup window, so is there any Java script or jqueryi have 3 combo boxes , already i have records in my database, it is appearing in to the combo boxes, so here thing is i have to select one record in each combo box. but no one combo box record should not match with the another combo box record, if it matches i want one small pop up window, and text should be change to --select--, it is web application in vb.net using asp.netBUT.....i tried like this , but if i select the first combo box also pop-window is coming , and remaining duplication is working fine, but when pop-window is coming but text is not changing sir, can you tell me , after pop-window, the combo box text should be like this --Select--. plz <script type ="text/javascript" >function onChange() {var cbAuth1 = document.getElementById('<%=cbAuthoriser1.ClientId%>');var cbAuth2 = document.getElementById('<%=cbAuthoriser2.ClientId%>');var cbAuth3 = document.getElementById('<%=cbAuthoriser3.ClientId%>');if (cbAuth1.value == cbAuth2.value && cbAuth1.value == cbAuth3.value) {alert("Authoriser2 and Authoriser3 should not match with Authoriser1");return false;}if (cbAuth2.value == cbAuth1.value && cbAuth2.value == cbAuth3.value) {alert("Authoriser1 and Authoriser3 should not match with Authoriser2");return false;}if (cbAuth3.value == cbAuth1.value && cbAuth3.value == cbAuth2.value) {alert("Authoriser1 and Authoriser2 should not match with Authoriser3");return false;}return true;}</script><telerik:RadComboBox runat="server" ID="cbAuthoriser1" Width="250px" EmptyMessage="Selct" AutoPostBack="true" önchange='onChange();'><telerik:RadComboBox runat="server" ID="cbAuthoriser2" Width="250px" EmptyMessage="Selct" AutoPostBack="true" önchange='onChange();'><telerik:RadComboBox runat="server" ID="cbAuthoriser3" Width="250px" EmptyMessage="Selct" AutoPostBack="true" önchange='onChange();'> 解决方案 function onChange() {var cbAuth1 = document.getElementById('<%=cbAuthoriser1.ClientId%>');var cbAuth2 = document.getElementById('<%=cbAuthoriser2.ClientId%>');var cbAuth3 = document.getElementById('<%=cbAuthoriser3.ClientId%>'); if (cbAuth1.value == cbAuth2.value || cbAuth1.value == cbAuth3.value) {alert("Authoriser2 and Authoriser3 should not match with Authoriser1");return false;} if (cbAuth2.value == cbAuth1.value || cbAuth2.value == cbAuth3.value) {alert("Authoriser1 and Authoriser3 should not match with Authoriser2");return false;} if (cbAuth3.value == cbAuth1.value || cbAuth3.value == cbAuth2.value) {alert("Authoriser1 and Authoriser2 should not match with Authoriser3");return false;} return true;}I have just replace && to || condition. :) 这篇关于我有3个组合框,每个组合框中有不同的值。但没有人不应该匹配用户的选择。有任何Java脚本或jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 10:00