首页 > Web开发 > 详细

silverlight 退出系统(关闭当前网页),通过调用JS

时间:2014-12-25 09:55:09      阅读:426      评论:0      收藏:0      [点我收藏+]

确认后直接退出系统,关闭当前页面

页面部分:

<HyperlinkButton x:Name="LinkExit" Style="{StaticResource LinkStyle}" TargetName="ContentFrame" Content="退出系统"/>

 

后台代码:

 1  //应用程序退出事件
 2         void LinkExit_Click(object sender, RoutedEventArgs e)
 3         {
 4             if (MessageBox.Show("确认退出系统?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
 5             {
 6                 //Silverlight调用JS
 7                 ScriptObject Show = HtmlPage.Window.GetProperty("closeWin") as ScriptObject;
 8                 Show.InvokeSelf();
 9             }
10         }
11 
12 aspx页面:
13 
14     <script>   
15 
16      function closeWin() {
17             //IE
18             //window.open(‘‘, ‘_parent‘, ‘‘);//弹出询问窗体
19             window.opener = null; //不弹出提示
20             window.close();
21         }
22     </script>

 

silverlight 退出系统(关闭当前网页),通过调用JS

原文:http://www.cnblogs.com/zxbzl/p/4183880.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!