0

我用onclientclick()方法创建了一个 Imagebutton,但是当我按下按钮时,会出现错误Microsoft JScript runtime error: 'test' is undefined

这是完整的代码代码:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Librerian_ReviewHistory.aspx.cs"
        Inherits="Library.Librerian_ReviewHistory" MasterPageFile="../user.Master" %>



<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <script type="text/javascript">

       function test()
       {

           window.open.('ShowUsers.aspx',null,'scrollbars=1,width=600,HEIGHT=400');

       }


    </script>


    <fieldset>
        <p>
            <asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
        </p>

            <p>
                <asp:TextBox runat="server" ID="Username" CssClass="textEntry"></asp:TextBox>
                <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                    CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required.">*</asp:RequiredFieldValidator>
                <asp:ImageButton ID="ImageButton1" runat="server" Text="Categories" ValidationGroup="v1"
                    ImageUrl="~/Account/user1.jpg" OnClientClick="test();" />
            </p>


    </fieldset>


</asp:Content>
4

1 回答 1

1

通过运行您的代码,一切似乎都很好。只需在 window.open 函数后删除多余的点(。)。您的功能将顺利运行。

于 2013-10-20T10:42:35.233 回答