【问题标题】:change LinkButton style attribute from javascript从 javascript 更改 LinkBut​​ton 样式属性
【发布时间】:2013-04-05 05:29:09
【问题描述】:

我想将linkbuttonstyle attribute 更改为javascript javascript,尝试为DropDownList工作,但不适用于linkbutton

这是我的代码

            </asp:ListItem>
            <asp:ListItem Text="vikas" Value="0">

            </asp:ListItem>
        </asp:DropDownList>
        <asp:LinkButton ID="lnkbtnSave" Style="display: none" Text="Save" runat="server"></asp:LinkButton>
        <asp:LinkButton ID="lnkbtnCancel" Style="display: none" Text="Cancel" runat="server"></asp:LinkButton>
        <asp:TextBox ID="lnkbtnTest" Style="display: none" Text="hope" runat="server"></asp:TextBox>
        <asp:LinkButton ID="lnkbtnChangeHR" Text="Change Hiring Manager:" runat="server"
            OnClientClick="javascript:return Visible(this.id);"></asp:LinkButton>
    </div>
    <script type="text/javascript" language="javascript">
        alert('dil sambhal ja jara');

        function Visible(me) {
            alert(document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnTest")));
            document.getElementById(me.replace("lnkbtnChangeHR", "ddlHiringManager")).style.display = 'inline';
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnSave")).style.display = 'inline';
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnCancel")).style.display = 'inline';
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnChnageHR")).style.display = 'none';
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnSave")).style.color = "#f6f6f6";
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnCancel")).style.color = "#f6f6f6";
            document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnTest")).style.display = 'inline';
            alert(document.getElementById(me.replace("lnkbtnChnageHR", "lnkbtnCancel")).style.display == 'none');
            return false;
        }
    </script>

【问题讨论】:

  • 如果问题不清楚,请告诉我
  • vikas,我认为您必须使用 CliendID 来获取像 &lt;=% lnkbtnTest.ClientID %&gt; 这样的 ASP.Net 控件,或者如果您使用的是 .Net framework 4.0 或更高版本,则在 ASP.Net 控件上指定 ClientIDMode="Static" msdn.microsoft.com/en-us/library/…
  • 得到了解决方案,感谢 Habib,这是 PICNIC

标签: javascript asp.net html css


【解决方案1】:

对不起,这是野餐

这是 lnkbtnChangeHR 而不是 lnkbtnChnageHR

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-27
    • 2011-06-19
    • 2017-05-30
    • 1970-01-01
    • 1970-01-01
    • 2014-10-12
    • 2020-12-30
    • 1970-01-01
    相关资源
    最近更新 更多