Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用下拉菜单在两个页面之间切换_C#_Javascript_Asp.net_Drop Down Menu - Fatal编程技术网

C# 使用下拉菜单在两个页面之间切换

C# 使用下拉菜单在两个页面之间切换,c#,javascript,asp.net,drop-down-menu,C#,Javascript,Asp.net,Drop Down Menu,您好,我有以下javascript和DropDownList: function loadanlasstyp(ddl) { var ControlName = document.getElementById(ddl.id); if (ControlName.value == "Event") { window.location = "../book/event.aspx"; }

您好,我有以下javascript和DropDownList:

function loadanlasstyp(ddl) {
            var ControlName = document.getElementById(ddl.id);

            if (ControlName.value == "Event") {
                window.location = "../book/event.aspx";

            }

            else if (ControlName.value == "Short Meeting") {
                window.location = "../book/shortmeeting.aspx";
            }
            return true;

        }
<asp:DropDownList ID="ddlAnlasstyp" runat="server" CssClass="ff" Height="21px" onChange="javascript:loadanlasstyp(this)"
                        TabIndex="3" Width="150px">
                        <asp:ListItem Value="Short meeting">Short</asp:ListItem>
                        <asp:ListItem Value="Event">Event</asp:ListItem>
</asp:DropDownList>
下拉列表:

function loadanlasstyp(ddl) {
            var ControlName = document.getElementById(ddl.id);

            if (ControlName.value == "Event") {
                window.location = "../book/event.aspx";

            }

            else if (ControlName.value == "Short Meeting") {
                window.location = "../book/shortmeeting.aspx";
            }
            return true;

        }
<asp:DropDownList ID="ddlAnlasstyp" runat="server" CssClass="ff" Height="21px" onChange="javascript:loadanlasstyp(this)"
                        TabIndex="3" Width="150px">
                        <asp:ListItem Value="Short meeting">Short</asp:ListItem>
                        <asp:ListItem Value="Event">Event</asp:ListItem>
</asp:DropDownList>

短
事件
我在两个页面上都有Javascript函数和Dropdownlist,所以我可以在它们之间切换。 默认情况下加载“Shortmeeting.aspx”。如果单击下拉列表中的“事件”,我可以从“Shortmeeting.aspx”切换到“Event.aspx”。现在,如果我想切换回“Shortmeeting.aspx”,我点击DropDownList中的“SHORT”,但它不起作用


如何在这两个页面之间正确切换?请帮助

只需删除值中的空白即可

Value=“短期会议”

Value=“Short”

在进行字符串匹配比较时,空格有时会产生问题。您可以创建字符串比较函数以供将来参考

function strcmp(a, b) {
if (a.toString() < b.toString()) return -1;
if (a.toString() > b.toString()) return 1;
return 0;
功能strcmp(a、b){
if(a.toString()b.toString())返回1;
返回0;
}

功能strcmp(a、b){
a=a.toString(),b=b.toString();
对于(变量i=0,n=Math.max(a.length,b.length);i b.charAt(i)?-1:1;
}

请参阅此链接以获取参考

只需删除值中的空白即可

Value=“短期会议”

Value=“Short”

在进行字符串匹配比较时,空格有时会产生问题。您可以创建字符串比较函数以供将来参考

function strcmp(a, b) {
if (a.toString() < b.toString()) return -1;
if (a.toString() > b.toString()) return 1;
return 0;
功能strcmp(a、b){
if(a.toString()b.toString())返回1;
返回0;
}

功能strcmp(a、b){
a=a.toString(),b=b.toString();
对于(变量i=0,n=Math.max(a.length,b.length);i b.charAt(i)?-1:1;
}

请参阅此链接以获取参考

区分大小写的“简短会议”和“简短会议”区分大小写的“简短会议”和“简短会议”这就是问题所在-。-。感谢您的帮助!这就是问题所在-。-。感谢您的帮助!