首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

两张页之间的传值!该如何解决

2012-01-24 
两张页之间的传值!用jsp做了一张普通页和一份日历页面。在普通页上点击相应的框可以弹出日历页面。然后可以

两张页之间的传值!
用jsp做了一张普通页和一份日历页面。在普通页上点击相应的框可以弹出日历页面。   然后可以在日历页面选择日期。
不知道有没有什么方法可以在日历页上直接点击日期,然后在普通页上显示此日期呢?

[解决办法]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<script language= "javascript ">
function openScript(url, width, height){
var Win = window.open(url, "openScript ", 'width= ' + width + ',height= ' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes ' );}
</script>

<SCRIPT language= "javascript ">
var bMoveable=false; //设置日历是否可以拖动
var _VersionInfo= "Version:2.0 "
//2.0作者:walkingpoison
//1.0作者: F.R.Huang(meizz)
//MAIL: meizz@hzcnc.com


var strFrame; //存放日历层的HTML代码
document.writeln( ' <iframe id=meizzDateLayer Author=wayx frameborder=0 style= "position: absolute; width: 144; height: 211; z-index: 9998; display: none "> </iframe> ');
strFrame= ' <style> ';
strFrame+= 'INPUT.button{BORDER-RIGHT: #ff9900 1px solid;BORDER-TOP: #ff9900 1px solid;BORDER-LEFT: #ff9900 1px solid; ';
strFrame+= 'BORDER-BOTTOM: #ff9900 1px solid;BACKGROUND-COLOR: #fff8ec;font-family:宋体;} ';
strFrame+= 'TD{FONT-SIZE: 9pt;font-family:宋体;} ';
strFrame+= ' </style> ';
strFrame+= ' <scr ' + 'ipt> ';
strFrame+= 'var datelayerx,datelayery; /*存放日历控件的鼠标位置*/ ';
strFrame+= 'var bDrag; /*标记是否开始拖动*/ ';
strFrame+= 'function document.onmousemove() /*在鼠标移动事件中,如果开始拖动日历,则移动日历*/ ';
strFrame+= '{if(bDrag && window.event.button==1) ';
strFrame+= ' {var DateLayer=parent.document.all.meizzDateLayer.style; ';
strFrame+= ' DateLayer.posLeft += window.event.clientX-datelayerx;/*由于每次移动以后鼠标位置都恢复为初始的位置,因此写法与div中不同*/ ';
strFrame+= ' DateLayer.posTop += window.event.clientY-datelayery;}} ';
strFrame+= 'function DragStart() /*开始日历拖动*/ ';
strFrame+= '{var DateLayer=parent.document.all.meizzDateLayer.style; ';
strFrame+= ' datelayerx=window.event.clientX; ';
strFrame+= ' datelayery=window.event.clientY; ';
strFrame+= ' bDrag=true;} ';
strFrame+= 'function DragEnd(){ /*结束日历拖动*/ ';
strFrame+= ' bDrag=false;} ';
strFrame+= ' </scr ' + 'ipt> ';
strFrame+= ' <div style= "z-index:9999;position: absolute; left:0; top:0; " onselectstart= "return false "> <span id=tmpSelectYearLayer Author=wayx style= "z-index: 9999;position: absolute;top: 3; left: 19;display: none "> </span> ';
strFrame+= ' <span id=tmpSelectMonthLayer Author=wayx style= "z-index: 9999;position: absolute;top: 3; left: 78;display: none "> </span> ';
strFrame+= ' <table border=1 cellspacing=0 cellpadding=0 width=142 height=160 bordercolor=#ff9900 bgcolor=#ff9900 Author= "wayx "> ';
strFrame+= ' <tr Author= "wayx "> <td width=142 height=23 Author= "wayx " bgcolor=#FFFFFF> <table border=0 cellspacing=1 cellpadding=0 width=140 Author= "wayx " height=23> ';
strFrame+= ' <tr align=center Author= "wayx "> <td width=16 align=center bgcolor=#ff9900 style= "font-size:12px;cursor: hand;color: #ffffff " ';
strFrame+= ' onclick= "parent.meizzPrevM() " title= "向前翻 1 月 " Author=meizz> <b Author=meizz> < </b> ';
strFrame+= ' </td> <td width=60 align=center style= "font-size:12px;cursor:default " Author=meizz ';


strFrame+= 'onmouseover= "style.backgroundColor=\ '#FFD700\ ' " onmouseout= "style.backgroundColor=\ 'white\ ' " ';
strFrame+= 'onclick= "parent.tmpSelectYearInnerHTML(this.innerText.substring(0,4)) " title= "点击这里选择年份 "> <span Author=meizz id=meizzYearHead> </span> </td> ';
strFrame+= ' <td width=48 align=center style= "font-size:12px;cursor:default " Author=meizz onmouseover= "style.backgroundColor=\ '#FFD700\ ' " ';
strFrame+= ' onmouseout= "style.backgroundColor=\ 'white\ ' " onclick= "parent.tmpSelectMonthInnerHTML(this.innerText.length==3?this.innerText.substring(0,1):this.innerText.substring(0,2)) " ';
strFrame+= ' title= "点击这里选择月份 "> <span id=meizzMonthHead Author=meizz> </span> </td> ';
strFrame+= ' <td width=16 bgcolor=#ff9900 align=center style= "font-size:12px;cursor: hand;color: #ffffff " ';
strFrame+= ' onclick= "parent.meizzNextM() " title= "向后翻 1 月 " Author=meizz> <b Author=meizz> > </b> </td> </tr> ';
strFrame+= ' </table> </td> </tr> ';
strFrame+= ' <tr Author= "wayx "> <td width=142 height=18 Author= "wayx "> ';
strFrame+= ' <table border=1 cellspacing=0 cellpadding=0 bgcolor=#ff9900 ' + (bMoveable? 'onmousedown= "DragStart() " onmouseup= "DragEnd() " ': ' ');
strFrame+= ' BORDERCOLORLIGHT=#FF9900 BORDERCOLORDARK=#FFFFFF width=140 height=20 Author= "wayx " style= "cursor: ' + (bMoveable ? 'move ': 'default ') + ' "> ';
strFrame+= ' <tr Author= "wayx " align=center valign=bottom> <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 日 </td> ';
strFrame+= ' <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 一 </td> <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 二 </td> ';
strFrame+= ' <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 三 </td> <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 四 </td> ';
strFrame+= ' <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 五 </td> <td style= "font-size:12px;color:#FFFFFF " Author=meizz> 六 </td> </tr> ';
strFrame+= ' </table> </td> </tr> <!-- Author:F.R.Huang(meizz) http://www.meizz.com/ mail: meizz@hzcnc.com 2002-10-8 --> ';
strFrame+= ' <tr Author= "wayx "> <td width=142 height=120 Author= "wayx "> ';
strFrame+= ' <table border=1 cellspacing=2 cellpadding=0 BORDERCOLORLIGHT=#FF9900 BORDERCOLORDARK=#FFFFFF bgcolor=#fff8ec width=140 height=120 Author= "wayx "> ';
var n=0; for (j=0;j <5;j++){ strFrame+= ' <tr align=center Author= "wayx "> '; for (i=0;i <7;i++){
strFrame+= ' <td width=20 height=20 id=meizzDay '+n+ ' style= "font-size:12px " Author=meizz onclick=parent.meizzDayClick(this.innerText,0)> </td> ';n++;}
strFrame+= ' </tr> ';}
strFrame+= ' <tr align=center Author= "wayx "> ';
for (i=35;i <39;i++)strFrame+= ' <td width=20 height=20 id=meizzDay '+i+ ' style= "font-size:12px " Author=wayx onclick= "parent.meizzDayClick(this.innerText,0) "> </td> ';
strFrame+= ' <td colspan=3 align=right > <span onclick=parent.closeLayer() style= "font-size:12px;cursor: hand " ';


strFrame+= ' > <u> 关闭 </u> </span> </td> </tr> ';
strFrame+= ' </table> </td> </tr> <tr Author= "wayx "> <td Author= "wayx "> ';
strFrame+= ' <table border=0 cellspacing=1 cellpadding=0 width=100% Author= "wayx " bgcolor=#FFFFFF> ';
strFrame+= ' <tr Author= "wayx "> <td Author=meizz align=left> <input Author=meizz type=button class=button value= " < < " title= "向前翻 1 年 " onclick= "parent.meizzPrevY() " ';
strFrame+= ' onfocus= "this.blur() " style= "font-size: 12px; height: 20px "> <input Author=meizz class=button title= "向前翻 1 月 " type=button ';
strFrame+= ' value= " < " onclick= "parent.meizzPrevM() " onfocus= "this.blur() " style= "font-size: 12px; height: 20px "> </td> <td ';
strFrame+= ' Author=meizz align=center> <input Author=meizz type=button class=button value=今天 onclick= "parent.meizzToday() " ';
strFrame+= ' onfocus= "this.blur() " title= "当前日期 " style= "font-size: 12px; height: 20px; cursor:hand "> </td> <td ';
strFrame+= ' Author=meizz align=right> <input Author=meizz type=button class=button value= " > " onclick= "parent.meizzNextM() " ';
strFrame+= ' onfocus= "this.blur() " title= "向后翻 1 月 " class=button style= "font-size: 12px; height: 20px "> <input ';
strFrame+= ' Author=meizz type=button class=button value= "> > " title= "向后翻 1 年 " onclick= "parent.meizzNextY() " ';
strFrame+= ' onfocus= "this.blur() " style= "font-size: 12px; height: 20px "> </td> ';
strFrame+= ' </tr> </table> </td> </tr> </table> </div> ';

window.frames.meizzDateLayer.document.writeln(strFrame);
window.frames.meizzDateLayer.document.close(); //解决ie进度条不结束的问题

//==================================================== WEB 页面显示部分 ======================================================
[解决办法]
页面传值的方法有多种,比如放到 session里,或则request.setAttribute()
[解决办法]
去这里看看吧:
http://www.javadingle.com

热点排行