Function expected error when window is closed

Hi All,

i am getting the following error when i try to close a window opened through client side before print dialog appears.
Error: function expected

I am opening a window and print dialog simultaneously, print dialog is taking few seconds to open after the window. before the print dialog is opened when i close the window i am getting the error.
below is my code,

function OnClick() {

        var a ='', '', 'width=300,height=300');"text/html");


<asp:Button ID=“btn” runat=“server” Text=“Click” OnClientClick=“OnClick()”/>

Can any one please help me how to resolve this issue.

Thanks you,


onClick is already a javascript function, that might cause an issue.

Thank you SpikeZ for your reply, even if i change the function name still its an issue. Issue is coming when i close the popup before print window is displayed.

function OnClick()

            var a ='', '', 'width=300,height=300');

            // presumably you're writing content here


            [B][COLOR="#0000FF"]if( !a.closed )[/COLOR][/B]

Thank you Logic Ali, i tried as you mentioned above but no use, still i am getting error.

Thank you once again.

Where do you see this error message and what data are you writing to the window?

in the popup we are loading some content to be printed.

please find the error image attached.