onclick="address2(${n})" 能把第几条传给javascript里的faction address2() 获得点击的是第几条数据
解决方案 »
- 求一个正则
- tomcat中应用程序的log在哪里?
- myeclipse下新建一个工程,文件夹src下跟WEB-INF\classes下的内容一样?
- 用户权限--急
- 我想自定义(增加)一个文件的属性,比如:author属性,将来可以通过file.author()来获得,就像file.length()一样,怎么实现呢?
- 弱弱的问你下,这样的java面试题目你会吗
- JSP为什么不能显示中文
- 只能输入数字(可以带正负号)的正则表达式怎么写?
- help!taglib的问题
- javascript如何连接access数据库(散分,满10人结贴)
- freemarker list 标签中嵌套 list
- spring和hibernate整合启动tomcat遇到的问题
另一个页面就可以获取到了
失败了,我还忘了说了 之前那个jsp并没关闭, 点那个jsp上的按纽查询 后 弹出了一个窗口的jsp,从这个窗口的jsp上选地址超链接点击,这个小窗口关闭,选的地址传到了之前那个jsp上了
我叙述的有问题 不是跳转 是关闭 前一个jsp上点击查询按纽后, 会弹出一个窗口形式的jsp,上面很多地址 点击一个超链接地址,窗口的jsp关闭,点击的地址传到前一个jsp上
用window.showModalDialog打开对话框
window.returnValue从打开的对话框返回值
你可以 试试看
//return用来接受弹出对话框的数据
var return = window.showModalDialog(url,window,sFeatures);
if(return!=null){
//这里处理返回过来的数据
}弹出框的js
window.returnValue = 直接写要返回的数据 一般用json;
window.clos();
主jsp 为A.jsp 上面有查询按纽,点击,走action,返回后是回到一个隐藏的jsp,B.jsp .
b.jsp里只有js,各种方法,body内容如下
<body onload="init();">
<form></form>
</body>
就是通过这个隐藏的b.jsp里的js方法处理查到的存在request里的数据,把这数据赋到a.jsp
我是现在要求检索数据时,如果是多条数据,需要弹出一个窗口c.jsp
window.open("./SearchZip.do?zip="+zipCode, "window_name", "width=780,height=350,scrollbars=yes,resizable=yes,statux=yes");
我把这句话放到了b.jsp里的js里的方法里调用
在走一个action后,把查询到的多条数据显示在c.jsp上,a.jsp还开着,c.jsp是以小窗口的形式开着的,
点击c.jsp里的数据超链接,把对应数据赋到a.jsp上
我本来查到了方法
window.opener.document.getElementById("AddressCity").value = "";
这个方法可以赋值给主体jsp里,可惜 我中间有一个隐藏的b.jsp抢了主体jsp的位置,最终数据就传不到a.jsp上了
这个超级链接,差点就有用了,结果我目前系统的古怪用不上
window.opener.document.getElementById("AddressCity").value = "";
愁死了
c.jsp 的js裡
function search1(n){
if(n.toString().length==1){
var code = '0' + n;
}else{
var code = n;
}
if(window.opener) {
fWindowText1 = window.opener.document.getElementById("Address1");
fWindowText1.value = code;
fWindowText2 = window.opener.document.getElementById("Address2");
fWindowText2.value = code;
window.close();
}
}b.jsp的js裡
var w;
var wTimer;
function wisclosed(){
if(w.closed){
window.clearInterval(wTimer)
var valueAddress1 = document.getElementById("Address1").value;
var valueAddress2 = document.getElementById("Address2").value;
with(window.parent.mainFrame.document.forms[0]) {
AddressP.value = valueAddress1;
AddressC.value = valueAddress2;
}
}
}
上面的AddressP, AddressC 為a.jsp頁面要傳的具體名稱關於window.open的部分
w =window.open("./SearchZip.do?zip="+zipCode+"&firstZipCode="+firstZipCode+"&secondZipCode="+secondZipCode, "window_name", "width=800,height=350,scrollbars=yes,resizable=yes,statux=yes");
if (w) {
window.w.focus();
}
wTimer=window.setInterval('wisclosed()',500);
body裡的部分
<form>
<input type="hidden" id="Address1" >
<input type="hidden" id="Address2" >
</form>
c.jsp 的js裡
function search1(n){
if(n.toString().length==1){
var code = '0' + n;
}else{
var code = n;
}
if(window.opener) {
fWindowText1 = window.opener.document.getElementById("Address1");
fWindowText1.value = code;
fWindowText2 = window.opener.document.getElementById("Address2");
fWindowText2.value = code;
window.close();
}
}b.jsp的js裡
var w;
var wTimer;
function wisclosed(){
if(w.closed){
window.clearInterval(wTimer)
var valueAddress1 = document.getElementById("Address1").value;
var valueAddress2 = document.getElementById("Address2").value;
with(window.parent.mainFrame.document.forms[0]) {
AddressP.value = valueAddress1;
AddressC.value = valueAddress2;
}
}
}
上面的AddressP, AddressC 為a.jsp頁面要傳的具體名稱關於window.open的部分
w =window.open("./SearchZip.do?zip="+zipCode+"&firstZipCode="+firstZipCode+"&secondZipCode="+secondZipCode, "window_name", "width=800,height=350,scrollbars=yes,resizable=yes,statux=yes");
if (w) {
window.w.focus();
}
wTimer=window.setInterval('wisclosed()',500);
body裡的部分
<form>
<input type="hidden" id="Address1" >
<input type="hidden" id="Address2" >
</form>
c.jsp 的js裡
function search1(n){
if(n.toString().length==1){
var code = '0' + n;
}else{
var code = n;
}
if(window.opener) {
fWindowText1 = window.opener.document.getElementById("Address1");
fWindowText1.value = code;
fWindowText2 = window.opener.document.getElementById("Address2");
fWindowText2.value = code;
window.close();
}
}b.jsp的js裡
var w;
var wTimer;
function wisclosed(){
if(w.closed){
window.clearInterval(wTimer)
var valueAddress1 = document.getElementById("Address1").value;
var valueAddress2 = document.getElementById("Address2").value;
with(window.parent.mainFrame.document.forms[0]) {
AddressP.value = valueAddress1;
AddressC.value = valueAddress2;
}
}
}
上面的AddressP, AddressC 為a.jsp頁面要傳的具體名稱關於window.open的部分
w =window.open("./SearchZip.do?zip="+zipCode+"&firstZipCode="+firstZipCode+"&secondZipCode="+secondZipCode, "window_name", "width=800,height=350,scrollbars=yes,resizable=yes,statux=yes");
if (w) {
window.w.focus();
}
wTimer=window.setInterval('wisclosed()',500);
body裡的部分
<form>
<input type="hidden" id="Address1" >
<input type="hidden" id="Address2" >
</form>
c.jsp 的js裡
function search1(n){
if(n.toString().length==1){
var code = '0' + n;
}else{
var code = n;
}
if(window.opener) {
fWindowText1 = window.opener.document.getElementById("Address1");
fWindowText1.value = code;
fWindowText2 = window.opener.document.getElementById("Address2");
fWindowText2.value = code;
window.close();
}
}b.jsp的js裡
var w;
var wTimer;
function wisclosed(){
if(w.closed){
window.clearInterval(wTimer)
var valueAddress1 = document.getElementById("Address1").value;
var valueAddress2 = document.getElementById("Address2").value;
with(window.parent.mainFrame.document.forms[0]) {
AddressP.value = valueAddress1;
AddressC.value = valueAddress2;
}
}
}
上面的AddressP, AddressC 為a.jsp頁面要傳的具體名稱關於window.open的部分
w =window.open("./SearchZip.do?zip="+zipCode+"&firstZipCode="+firstZipCode+"&secondZipCode="+secondZipCode, "window_name", "width=800,height=350,scrollbars=yes,resizable=yes,statux=yes");
if (w) {
window.w.focus();
}
wTimer=window.setInterval('wisclosed()',500);
失败了,我还忘了说了 之前那个jsp并没关闭, 点那个jsp上的按纽查询 后 弹出了一个窗口的jsp,从这个窗口的jsp上选地址超链接点击,这个小窗口关闭,选的地址传到了之前那个jsp上了
你确定你后台actiont有get set,吗