海东的技术资料
博客园
::
首页
:: ::
联系
::
订阅
::
管理
::
205 随笔 :: 22 文章 :: 678 评论 :: 60 Trackbacks
关于IE6和IE7关闭窗口时提示和不提示以及上传图片前的本地预览解决办法
1 IE6和IE7关闭窗口时提示和不提示
2 上传文件立即显示效果图,在ie7中可以用滤镜
<!--
以下均支持IE6和IE7,不支持Firefox2.0,其他浏览器未经测试
-->
<
script
type
="text/javascript"
>
function
CloseWin()
//
这个会提示是否关闭浏览器
{
window.opener
=
null
;
window.open(
""
,
"
_self
"
);
window.close();
}
如果在框架中关闭整个框架页面的话如下
这个是不提示关闭
function
aa ( )
{
if
(window.confirm('您确认要退出系统吗?'))
{
top.opener
=
null
;
top.open(
""
,
"
_self
"
);
top.close();
window.close;
}
else
{
return
false
;}
}
function
Preview(imgFile)
{
document.getElementById(
"
pic
"
).filters.item(
"
DXImageTransform.Microsoft.AlphaImageLoader
"
).src
=
imgFile.value;
}
</
script
>
<
a
href
="javascript:CloseWin();"
>
点击这里无提示关闭当前窗口
</
a
><
br
/>
请选择要预览的图片:
<
input
type
="file"
onchange
="javascript:Preview(this);"
/><
br
/>
<
div
id
="pic"
style
="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:400px;height:200px;"
></
div
>
获取图片的大小
var img=new Image();
img.src=imgFile.value;
alert(img.fileSize);
alert(img.width);
alert(img.height);
posted on 2007-06-19 11:56
高海东
阅读(2009)
评论(7)
编辑
收藏
所属分类:
ASP.NET 2.0
评论
#1楼
2007-07-06 11:47
Andy [未注册用户]
非常好,解决了我的问题,谢谢!
回复
引用
#2楼
2007-09-21 16:45
弦音 [未注册用户]
能不能实现点击IE7的关闭按钮提示关闭啊?!
回复
引用
#3楼
2007-11-29 14:41
Sutra [未注册用户]
@弦音
你可以参考一下
http://blogmover.redv.com
是怎么实现的。
//if (window.addEventListener) {
// window.addEventListener("beforeunload", doClose, false);
//}
//else if (window.attachEvent) {
// window.attachEvent("onbeforeunload", doClose);
//}
//else {
window.onbeforeunload = doClose;
//}
function doClose() {
var t = "───────────────────────\r\n您确定要离开 Blog Mover 吗?\r\n确定后未完成的操作你将无法控制。\r\n───────────────────────";
return t;
}
回复
引用
#4楼
2007-12-10 11:55
brucechen [未注册用户]
I've had the same issue... and did a bit of research on my own to see if I could find a work-around for this.
I have created a simple testing example online to try out different methods of opening new windows and having them self-close:
http://sky.prohosting.com/savage25/AutoCloseExample.html
As you can see from the descriptions within it, IE6 and IE7 react differently in several of the cases. Hence the "issue" that IE7 has created...
In particular, the one that is causing me issues is the FORM submission using a "_blank" target window. It closes without confirmation in IE6, but does not in IE7.
A work-around that I discovered: IE7 may actually have become less secure when JAVASCRIPT redirects the current page (within the same window), and then this redirected-to site closes the window... the page then closes without any confirmation. I was able to use this "bug" (?) to my advantage as a work-around to solve the problem.
Instead of calling "window.close()" to close the current window... do this:
window.open('close.html', '_self');
Where "close.html" contains:
<html><body>
<script language="JavaScript">window.close();</script>
</body></html>
This should work in both IE6 and IE7 to close the current window without confirmation.
I am currently using it in my application and it works well.
Paul Narsavage
Bethlehem, PA, USA
savage_25 at yahoo.com
回复
引用
#5楼
2008-03-12 17:03
daweisun [未注册用户]
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "提示", "window.opener=null;window.open('', '_self');window.close()", true);
回复
引用
#6楼
2008-06-19 13:08
leesun [未注册用户]
恩,至少IE6,7都没问题,谢谢楼主
thanks!I 支持YOU
回复
引用
社区
新闻
新用户注册
刷新评论列表
标题
姓名
主页
Email
(只有博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
相关文章:
关于IE问题,请教和求救
电脑故障处理小经验—IE无法打开链接的处理方法
关于IE7关闭窗口时总是提示和上传图片前的本地预览解决办法
关于IE6和IE7关闭窗口时提示和不提示以及上传图片前的本地预览解决办法
【整理】【最近更新日期:2005-10-15】【找工作必读!】来自IT公司速查手册的各大IT公司薪资和待遇内幕
郁闷的IE字体大小变化问题:(
相关链接:
所属分类的其他文章:
数据回发时,维护ASP.NET Tree控件位置
关于IE6和IE7关闭窗口时提示和不提示以及上传图片前的本地预览解决办法
ASP.NET2.0打通文件图片处理任督二脉(转载)
如何去掉ie里面的关闭按钮,和屏蔽ALT+F4 (转载)
基于RBAC模型的通用权限管理系统的设计(数据模型)的扩展
ASP.NET 中处理页面“回退”的方法
在 ASP.NET 上实现锁定表头、支持滚动的表格的做法
通过避免下列 10 个常见 ASP.NET 缺陷使网站平稳运行(转载)
常见的 Web 项目转换问题及解决方案(转载)
同时安装vs2005团队开发版和sql 2005企业版(转载)
最新IT新闻:
Microsoft F# CTP(2008年9月)
微软4.86亿美元收购Greenfield
苹果已然取代微软地位成行业众矢之的
Intel 收购 Poky Linux ,为 MID 注入新的动力
雅虎将关闭社交网站Mash
博客园新闻频道
博客园首页
社区
<
2007年6月
>
日
一
二
三
四
五
六
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
公告
电子邮箱:ghd258@gmail.com MSN:
ghd258@hotmail.com
您是第
位访问者
与我联系
发短消息
搜索
我参加的小组
Web技术联盟
我参与的团队
.NET 控件与组件开发(1/1363)
广州.NET俱乐部(0/1718)
Ajax&Atlas技术团队(0/1148)
.NetFramework3.0 & 3.5(WCF,WPF,WF)团队(0/566)
微软(西安).NET开发俱乐部(0/741)
随笔分类
(216)
.Net Remoting
(rss)
ADO.NET 2.0(4)
(rss)
AJAX(1)
(rss)
ASP.NET(57)
(rss)
ASP.NET 2.0(38)
(rss)
C#(15)
(rss)
CSS(4)
(rss)
Enterprise Library (2)
(rss)
JS(21)
(rss)
NUnit(1)
(rss)
Oracle(6)
(rss)
SQL SERVER 2000(22)
(rss)
SQL SERVER 2005(11)
(rss)
WEB SERVICE(1)
(rss)
Windows Workflow Foundation (5)
(rss)
WINFORM
(rss)
XML(6)
(rss)
功能函数(5)
(rss)
俱乐部事宜(2)
(rss)
其他
(rss)
软件工程(3)
(rss)
数据库
(rss)
水晶报表(3)
(rss)
图片(3)
(rss)
项目管理(4)
(rss)
业界新闻(1)
(rss)
正则表达式(1)
(rss)
智能客户端技术
(rss)
文章分类
(23)
.Net Remoting
(rss)
ADO.NET
(rss)
ASP.NET(10)
(rss)
ASP.NET2.0
(rss)
C#(2)
(rss)
CSS
(rss)
js(5)
(rss)
Oracle
(rss)
SQL SERVER 2000(5)
(rss)
SQL SERVER 2005
(rss)
WEB SERVICE 技术
(rss)
XML
(rss)
项目管理(1)
(rss)
智能客户端技术
(rss)
相册
我的家园
我的证书
收藏夹
(325)
ADO.NET(21)
(rss)
ADO.NET 2.0
(rss)
ASP.NET(94)
(rss)
ASP.NET 2.0(116)
(rss)
C#(16)
(rss)
JS(23)
(rss)
NUnit(5)
(rss)
SQL SERVER 2000(12)
(rss)
SQL SERVER 2005(20)
(rss)
WEB SERVICE(14)
(rss)
XML(3)
(rss)
智能客户端技术(1)
(rss)
连接
BizTalk学习笔记系列
DooIT(ttyp)
Gmail - 收件箱
MSDN Webcast 中心
NFramework开源AOP框架
Rickie Lee's blog
zlz_212的专栏(Dundas Chart )
代码生成工具CodePlusV2.0
老赵点滴“深入Atlas系列”
清清月儿 .NET
深圳.NET 俱乐部
我CSDN的BLOG
邀月的博客日记
积分与排名
积分 - 362133
排名 - 60
最新随笔
1. 微软西安.NET俱乐部(.NET User Group) 邀请主讲讲师
2. 热烈庆祝西安.NET俱乐部加入微软.NET俱乐部(.NET User Group)
3. Enterprise Library 4.0 - May 2008 发布了
4. SQL语句对表中父子节点正向和反向取所有节点
5. 微软(西安).NET俱乐部成立聚会和Visual Studio 2008 社区发布全国巡展邀请函
6. 西安.NET俱乐部聚会活动意见征询
7. 数据库设计经验之谈(转载)
8. “保证软件测试质量的4个根基”主题培训峰会
9. 数据回发时,维护ASP.NET Tree控件位置
10. 国内项目开发过程分析总结
11. 解析.Net框架下的XML编程技术 (转载)
12. asp.net2.0导出pdf文件完美解决方案(转载)
13. 关于IE6和IE7关闭窗口时提示和不提示以及上传图片前的本地预览解决办法
14. ASP.NET2.0打通文件图片处理任督二脉(转载)
15. 项目开发经验谈(二)
16. 项目开发经验谈(一)
17. 在项目开发总的一些感受,希望大家共同来探讨项目管理中的一些看法
18. js技巧收集(200多个) (转)
19. [Javascript] 如何在客户端验证表单被改变
20. 如何去掉ie里面的关闭按钮,和屏蔽ALT+F4 (转载)
21. 深入理解JavaScript中的函数
22. 庆祝"西安.NET俱乐部"成立,请申请加入的朋友在这里报到
23. 在SQL Server 2005中用存储过程实现搜索功能
24. 55种网页常用小技巧(javascript)
25. 精妙的SQL和SQL SERVER 与ACCESS、EXCEL的数据导入导出转换
26. 基于RBAC模型的通用权限管理系统的设计(数据模型)的扩展
27. ASP.NET 中处理页面“回退”的方法
28. 在 ASP.NET 上实现锁定表头、支持滚动的表格的做法
29. 事半功倍系列之javascript (转载)
30. 利用键盘上的上下左右(回车)键模拟出tab 键的功能上下左右移动焦点
Powered by:
博客园
Copyright © 高海东