我用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>