Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.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
如何使用aspx.cs中的javascript函数更改aspx?_Javascript_Asp.net_Button - Fatal编程技术网

如何使用aspx.cs中的javascript函数更改aspx?

如何使用aspx.cs中的javascript函数更改aspx?,javascript,asp.net,button,Javascript,Asp.net,Button,我正在从事一个asp.net web应用程序项目,我有一个按钮,它使用javascript作为下拉菜单: <asp:Button ID="BtnPlant1" runat="server" Width="160px" BackColor="Transparent" Height="40px" CssClass="buttonStyle" onmouseover="MM_showMenu(window.langT,0,40,nu

我正在从事一个asp.net web应用程序项目,我有一个按钮,它使用javascript作为下拉菜单:

<asp:Button ID="BtnPlant1" runat="server" Width="160px" BackColor="Transparent"
                                Height="40px" CssClass="buttonStyle" onmouseover="MM_showMenu(window.langT,0,40,null,'BtnPlant1');" 
              onmouseout=MM_startTimeout();/>

我该怎么做?有什么想法吗?谢谢…

您应该有jquery。。。因此,请尝试以下方法:

<asp:Button ID="BtnPlant1" runat="server" Width="160px" BackColor="Transparent"
                                Height="40px" CssClass="buttonStyle" onmouseover="showMenu()" 
              onmouseout=MM_startTimeout();/>
不是测试者

解决方案:

function showMenu() {
           if($("#ddlistid option:selected").text() == "langE")
               MM_showMenu(window.langE,0,40,null,'BtnPlant1');
           else
                MM_showMenu(window.langT,0,40,null,'BtnPlant1');
         }

将window.langT更改为此。已选择选项[0]。innerText
function showMenu() {
       if($('.dropdownlist').val() == "langE")
         MM_showMenu(window.langE,0,40,null,'BtnPlant1');
       else
         MM_showMenu(window.langT,0,40,null,'BtnPlant1');
}

$('.dropdownlist').change(function() {
  showMenu();  
}
function showMenu() {
           if($("#ddlistid option:selected").text() == "langE")
               MM_showMenu(window.langE,0,40,null,'BtnPlant1');
           else
                MM_showMenu(window.langT,0,40,null,'BtnPlant1');
         }