2014年7月13日 星期日

[RESOLVED] Unable to close the window


Hi,

I have this


OnClientClick="window.close()"





for the Linkbutton. when I run the page locally using "http://192.168...", I can close the IE window by this. But when I run the same page of the website in other machine other than using "http://192.168...", the window cannot be closed by such way. why?



See following for crossbrowser solution for window close() funciton


http://csharpdotnetfreak.blogspot.com/2008/11/javascript-windowclose-does-not-work-in.html



try this


window.open('', '_self', '');


window.close()



 


 



Thanks all.


Sorry, with these codes



Testing











 

...
Text = "Exit"
CssClass="lbstandard2"
Forecolor="#0A2757"
Font-Names="Times New Roman"
Font-Size="8pt"
OnClick="closeMe()"
runat="server"/>
...







I've got this problem



Server Error in '/App16_devst' Application.

--------------------------------------------------------------------------------





Compilation Error

  Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.




 Compiler Error Message: CS1061: 'ASP.default_aspx' does not contain a definition for 'closeMe' and no extension method 'closeMe' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?)



Source Error:





 



Line 93:                runat="server"/>

Line 94:                 | 

Line 95:            
Line 96:                Text = "Exit"

Line 97:                CssClass="lbstandard2"

 



Source File: c:\inetpub\VS2012\App16_devst\Default.aspx    Line: 95







Show Detailed Compiler Output:









 

 





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044 




 that's becasue you have to call this javascript function via "OnClientClick" 


 OnClientClick="closeMe()"

Onclick will go for the code Behind .

 



Thanks. Can I have a confirmation prompt when closing that?


沒有留言:

張貼留言