惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 笨笨丁

IIS启用兼容模式设置(win2k3—Win7) C#调用java类、jar包方法(转) 解决VML遭遇IE8和XHTML DOCTYPE时不能运行的问题(转) Nice Validator(Form验证)及Juery zTree控件 ASP.NET程序中 抛出"Thread was being aborted. "异常(转) SQL语句Where中使用别名作为判断条件 50个令人惊奇的jQuery插件(对话框和表单篇)及免费的响应式bootstrap管理员后台界面主题 - Charisma PowerDesigner设计时表显示注释选项 在网页中怎样给已发布的Flash添加链接的方法(zhuan) ASP.NET网站中获取当前虚拟目录的应用程序目录的方法(转) __doPostBack()没有定义解决方法(转) jQuery插件实战之fullcalendar(日历插件) - 使用fullcalendar开发一个功能完整的富客户端会议室预定系统(转) ajaxpro返回值类型总结-DataTable(转) Ibatis.net总是报:【ExecuteStoreCommand SqlParameterCollection 中已包含 SqlParameter】(转) jQuery校验validate详解(转) 一个.NET通用JSON解析/构建类的实现(c#)转 C# JSON字符串序列化与反序列化(转) AjaxPro新发现-错误处理 SVN专题:SVN Client API的.net 接口 SharpSvn介紹 Checkout操作实例,SVN权限(转)
showModalDialog 的重要提示
笨笨丁 · 2013-08-23 · via 博客园 - 笨笨丁

模态对话框,没有opener,不能用window.opener.location.reload();或window.parent.location.reload();
要通过返回值来判断关闭后刷新

function   openWindow(url,   xsize,   ysize)
{
  res   =   showModalDialog(url, " ", "dialogWidth: "+xsize+ ";dialogHeight: "+ysize+ ";status=no;help:no;center:yes ")  
    if   (res== 'ok ')   window.location.reload(1)
}

and   in   the   dialog   use
<td   onclick= "window.returnValue= 'ok ';window.close();   "> Close </td> 

上传文件由于要给一个上传是否成功的提示,因为我们用的是struts2框架,只能通过跳转页面来给提示,由于在模态对话框中,如果再提交页面的话,用户体验就太不好了,因此要选择异步提交,那怎样异步上传文件呢?

从网上找到了一个异步上传文件的插件:ajaxfileupload.js

 $.ajaxFileUpload(
                   {
		                url:'${pageContext.request.contextPath}/${param.url}.action',            //需要链接到服务器地址
		                secureuri:false,
		                fileElementId:'upLoadFile',                        //文件选择框的id属性
		                dataType: 'json',                                     //服务器返回的格式,可以是json
		                success: function (data, status)            //相当于java中try语句块的用法
		                {      
			                if(data.success==true)
			                {
			                    alert('上传成功!');
			                    window.returnValue='ok';//返回值
				  	    window.close(); //关闭窗口
				         }
				  	else if(data.success ==false){		
						  alert('上传失败!');
			                }
		                },
		                error: function(){
					//alert("error");
			         },
			         complete:function(XMLHttpRequest, textStatus){
			               //alert("complete");
			        }
                     }

5. form

<form action="${pageContext.request.contextPath}/uploadFile.action"					
method="post" enctype="multipart/form-data" target="_self">
<input type="file"  name="upLoadFile" id="upLoadFile"  />
<input type="button" value="上传" onclick="ajaxFileUpload()" />
</form>