- 浏览: 1130594 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
1 使用form做提交,target设为iframe的name:
2 使用ajax。以div域的局部刷新为例,假设页面中有
birt结合ajax做报表区域局部刷新的例子:
http://www.roseindia.net/answers/viewanswers/1936.html
Q & A:Div as Form Target,Possible?
Q:
关于ajax乱码问题:
使用以下代码,传给birt的中文省名provinceName老是乱码:
后改成通过XmlHttpRequest的send方法来传参,解决了这个乱码问题:
貌似得出的结论就是:
如果使用ajax做中文参数的传递,不要在url中做中文参数的追加,使用XmlHttpRequest.send(参数串)来传参,参数串里的中文就不会乱码。
引用
<iframe name="info" id="info" frameborder="0" src="" scrolling="no" width="100%" height="1000"></iframe>
<form id="mapForm" name="mapForm" action="" method="post" [b]target="info"[/b]>
2 使用ajax。以div域的局部刷新为例,假设页面中有
<div id="mapDiv" name="mapDiv">,在ajax的回调方法中,使用document.getElementById("mapDiv").innerHTML =xmlhttp.responseText即可实现该div区域的局部刷新。
birt结合ajax做报表区域局部刷新的例子:
http://www.roseindia.net/answers/viewanswers/1936.html
var xmlhttp = new getXMLObject(); function 调用ajax的函数() { if(xmlhttp) { //URL中带中文不行,故通过xmlhttp的send(params)来传递(中文)参数 //var url = "<%=request.getContextPath()%>/preview?__report=rptfiles/tuition_map.rptdesign&startDate=${startDate}&endDate=${endDate}&province=" + encodeURIComponent(provinceName); var url = "<%=request.getContextPath()%>/preview"; var params = "__report=rptfiles/tuition_map.rptdesign&startDate=${startDate}&endDate=${endDate}&province=" + provinceName; //alert(url); //alert(params); xmlhttp.open("POST",url,true); xmlhttp.onreadystatechange = handleServerResponse; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8'); xmlhttp.send(params); } } //XML OBJECT function getXMLObject() { var xmlHttp = false; try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP") // For Old Microsoft Browsers } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") // For Microsoft IE 6.0+ } catch (e2) { xmlHttp = false // No Browser accepts the XMLHTTP Object then false } } if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers } return xmlHttp; // Mandatory Statement returning the ajax object created } function handleServerResponse() { if (xmlhttp.readyState == 4) { //if(xmlhttp.status == 200) { //alert(xmlhttp.responseText); document.getElementById("mapDiv").innerHTML =xmlhttp.responseText; //} // else { // alert("Error during AJAX call. Please try again"); // } } }
Q & A:Div as Form Target,Possible?
Q:
引用
Does anyone know how to target a <DIV...>. I want to put an HTML form
in a DIV. When it's submitted, the results should show up within that
same DIV. Possible?
A:in a DIV. When it's submitted, the results should show up within that
same DIV. Possible?
引用
You can't target a div the way you can a frame;
you'd have to use AJAX techniques: have a button that triggers,
instead of a form submission, a call to a JavaScript function that
manually assembles and POSTs the same query that the browser would
assemble if you had really submitted the form, with a callback to a
JavaScript function that populates the div with the results. There
are JavaScript libraries that make this task easier (dojo, Yahoo!,
etc), but you still need to know how to program...
you'd have to use AJAX techniques: have a button that triggers,
instead of a form submission, a call to a JavaScript function that
manually assembles and POSTs the same query that the browser would
assemble if you had really submitted the form, with a callback to a
JavaScript function that populates the div with the results. There
are JavaScript libraries that make this task easier (dojo, Yahoo!,
etc), but you still need to know how to program...
关于ajax乱码问题:
使用以下代码,传给birt的中文省名provinceName老是乱码:
var url = "<%=request.getContextPath()%>/preview?__report=rptfiles/tuition_map.rptdesign&startDate=${startDate}&endDate=${endDate}&province=" + provinceName; xmlhttp.open("POST",url,true); xmlhttp.onreadystatechange = 回调函数的名字; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8'); xmlhttp.send(null);使用什么escape() encodeURI() encodeURIComponent()对url中的中文provinceName做转化都无法解决问题;
后改成通过XmlHttpRequest的send方法来传参,解决了这个乱码问题:
var url = "<%=request.getContextPath()%>/preview"; var params = "__report=rptfiles/tuition_map.rptdesign&startDate=${startDate}&endDate=${endDate}&province=" + provinceName; xmlhttp.open("POST",url,true); xmlhttp.onreadystatechange = 回调函数的名字; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8'); xmlhttp.send(params);
貌似得出的结论就是:
如果使用ajax做中文参数的传递,不要在url中做中文参数的追加,使用XmlHttpRequest.send(参数串)来传参,参数串里的中文就不会乱码。
发表评论
-
页面嵌入声音
2011-06-27 20:17 1178几个选择: embed标签 bgsound标签 objec ... -
DHTMLX
2011-05-13 09:53 2331通过 Access IFRAME Content 实现 dht ... -
ajax:Add exception message to json response
2011-05-06 10:07 1850Add exception message to json r ... -
W3C DOM 之 (nodeName || tagName) && nodeType && nodeValue
2010-11-21 16:34 1226tagName和nodeName的区别 http://blog ... -
Js之appendChild() insertBefore() 和扩展的 insertAfter()
2010-11-21 16:14 2925JavaScript之appendChild、insertBe ... -
Extending js Array Prototype
2010-08-11 16:55 1235Extending array prototype with ... -
parentNode与parentElement区别 childNodes与children区别
2010-08-11 11:47 2800parentElement and children is f ... -
readonly和Disabled的区别;display:none和visible:hidden的区别
2010-07-29 11:59 3967Readonly和Disabled: http://www.c ... -
Editable Select 可编辑select
2010-03-30 18:58 7147极棒的一段Editale Select代码: http://w ... -
多用try catch做js调试
2010-03-27 15:00 2356碰到莫名其妙的js错误,多用try catch做调试! 在调 ... -
当onblur遇到focus()
2010-03-19 13:46 2039当onblur触发的function中使用了aElement. ... -
URL中文乱码问题
2010-01-22 00:19 1943解决办法: 一 使用form做提交 二 前台jsp页面编码方 ... -
frame,iframe,frameset之间的关系与区别
2009-11-12 15:11 1765http://www.cnblogs.com/wennxxin ... -
使用JS刷新showModalDialog窗口
2009-09-26 21:28 3630http://midnightair.iteye.com/bl ... -
getElementsByName无法获得Div
2009-09-20 14:40 2770<input name="test" ... -
js 去掉html标记 去掉换行
2009-09-16 20:15 2696mymsg=mymsg.replace(/<\/?. ... -
document.getElementById为空或不是对象的解决方法
2009-09-11 09:32 4241在使用document.getElementById时,遇到个 ... -
十大JavaScript函数 Top 10 custom JavaScript functions
2009-09-03 22:38 2020http://www.dustindiaz.com/basem ... -
关于js 中的 $()
2009-09-03 21:22 2023并不是js的什么特殊用法。其实只是你的页面引用到的js(或被i ... -
DIV Alert
2009-09-03 19:22 1059透明的DIV提示框 http://www.cnblogs.co ...
相关推荐
第14章 jsp开发的两种模型 441 14.1 模型1 441 14.2 模型2 445 14.3 小结 449 第15章 标签库(tag library) 450 15.1 标签库api 450 15.1.1 标签的形式 451 15.1.2 tag接口 451 15.1.3 iterationtag接口 ...
HTML5支持多图片上传,而且支持ajax上传,而且支持上传之前图片的预览,而且支持图片拖拽上传,而且还是纯粹利用file控件实现,JS代码寥寥,想不让人称赞都难啊! HTML5Ajax上传 html5的上传实现,是需要file控件...
三层+EasyUI+Ajax提交Form表单。压缩包内包含代码和数据库脚本。
用jquery动态添加表单,通过jquery.form来ajax提交来批量上传图片
FORM + CODE示例实例代码来自Casey Reas,Chandler McWilliams和LUST撰写的《设计,艺术和建筑中的FORM + CODE》一书。 该存储库包含作者创建的处理示例,以及其他语言(包括ActionScript,Cinder和OpenFrameworks)...
jquery.js + jquery-form.js + springMVC实现ajax提交form表单和上传图片,上传图片成功js可以获取图片保存相对路径。
通过Django的Form方式上传文件,简单,但无法局部刷新实现ajax效果; 通过js或jQuery方式,需要使用FormData对象,仍有些浏览器不兼容; 通过Form+iframe方式上传文件,兼容性最好。 里面含有全部源代码。
PHP多文件上传插件,PHP+jQuery+Ajax多图片上传 效果查看:https://blog.csdn.net/chendongpu/article/details/123545180
用iframe提交表单,主要是将表单提交到iframe中,可实现无刷新提交。 html页面: <iframe name="FORMSUBMIT" width="1" height="1" ></iframe> <form action="login....
UCanCode E-Form++源码组件库代码, 这是航空建模与仿真部分.
mvc4 + easyui form 异步提交示例,解决返回出现下载对话框的问题
非常有名的UCanCode E-Form++图形源码库代码, 此代码用于展示建模与仿真.
E-Form++可视化源码库 XML解析源码,如何利用XML进行文件的存取和读取。
ajax刷新表格数据 ajaxform异步提交表单数据, jquery.validate验证表单数据
关于STRUTS标签的一些详细说明。 如:<html:form>的说明。
第14章 jsp开发的两种模型 441 14.1 模型1 441 14.2 模型2 445 14.3 小结 449 第15章 标签库(tag library) 450 15.1 标签库api 450 15.1.1 标签的形式 451 15.1.2 tag接口 451 15.1.3 iterationtag接口 ...
第14章 jsp开发的两种模型 441 14.1 模型1 441 14.2 模型2 445 14.3 小结 449 第15章 标签库(tag library) 450 15.1 标签库api 450 15.1.1 标签的形式 451 15.1.2 tag接口 451 15.1.3 iterationtag接口 ...
第14章 jsp开发的两种模型 441 14.1 模型1 441 14.2 模型2 445 14.3 小结 449 第15章 标签库(tag library) 450 15.1 标签库api 450 15.1.1 标签的形式 451 15.1.2 tag接口 451 15.1.3 iterationtag接口 ...
下面小编就为大家带来一篇form+iframe解决跨域上传文件的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧