0

I have created an Imagebutton with an onclientclick() method, but when i push the button the error Microsoft JScript runtime error: 'test' is undefined appears.

Here is the complete code code:

    <%@ 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>
1
  • 1
    Try to write js function in header section. Also there is dot(.) after window.open Oct 20, 2013 at 10:34

1 Answer 1

1

By running your code everything seems to be alright. just remove extra dot(.) after window.open function. Your function will run smoothly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.