index_inc.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:6k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="cn.js.fan.web.*"%>
  3. <SCRIPT language=javascript>
  4. //more javascript from http://www.smallrain.net
  5. window.onload = enetgetMsg;
  6. window.onresize = enetresizeDiv;
  7. window.onerror = function(){}
  8. var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
  9. function enetgetMsg()
  10. {
  11. try{
  12. enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
  13. enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10)
  14. enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
  15. enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
  16. enetdocWidth = document.body.clientWidth;
  17. enetdocHeight = document.body.clientHeight;
  18. document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;// enetdivHeight
  19. document.getElementById("enetMeng").style.left = parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth
  20. if (isShow()) {
  21. document.getElementById('enetMeng').style.visibility='visible';
  22. enetobjTimer = window.setInterval("enetmoveDiv()",10)
  23. }
  24. else {
  25. document.getElementById('enetMeng').style.visibility='hidden';
  26. }
  27. }
  28. catch(e){}
  29. // 用于点击天气预报后的显示
  30. function showWeather()
  31. {
  32. enetcloseDiv();
  33. try{
  34. enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
  35. enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10)
  36. enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
  37. enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
  38. enetdocWidth = document.body.clientWidth;
  39. enetdocHeight = document.body.clientHeight;
  40. document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;// enetdivHeight
  41. document.getElementById("enetMeng").style.left = parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth
  42. document.getElementById("enetMeng").style.visibility="visible"
  43. enetobjTimer = window.setInterval("enetmoveDiv()",10)
  44. }
  45. catch(e){}
  46.  
  47. function enetresizeDiv()
  48. {
  49. i+=1
  50. if(i>600) enetcloseDiv()
  51. try{
  52. enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
  53. enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
  54. enetdocWidth = document.body.clientWidth;
  55. enetdocHeight = document.body.clientHeight;
  56. document.getElementById("enetMeng").style.top = enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)
  57. document.getElementById("enetMeng").style.left = enetdocWidth - enetdivWidth + parseInt(document.body.scrollLeft,10)
  58. }
  59. catch(e){}
  60. }
  61. function enetmoveDiv()
  62. {
  63. try
  64. {
  65. if(parseInt(document.getElementById("enetMeng").style.top,10) <= (enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)))
  66. {
  67. window.clearInterval(enetobjTimer)
  68. enetobjTimer = window.setInterval("enetresizeDiv()",1)
  69. }
  70. enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
  71. document.getElementById("enetMeng").style.top = enetdivTop - 3
  72. }
  73. catch(e){}
  74. }
  75. function enetcloseDiv()
  76. {
  77. i = 0;
  78. document.getElementById('enetMeng').style.visibility='hidden';
  79. if(enetobjTimer) window.clearInterval(enetobjTimer)
  80. }
  81. // cookie操作
  82. function getCookieVal(offset)
  83. {
  84. var endstr=document.cookie.indexOf(";",offset);
  85. if(endstr==-1)
  86. endstr=document.cookie.length;
  87. return unescape(document.cookie.substring(offset,endstr));
  88. }
  89. function GetCookie(name)
  90. {
  91. var arg=name+"=";
  92. var alen=arg.length;
  93. var clen=document.cookie.length;
  94. var i=0;
  95. while(i<clen)
  96. {
  97. var j=i+alen;
  98. if(document.cookie.substring(i,j)==arg)
  99. return getCookieVal(j);
  100. i=document.cookie.indexOf(" ",i)+1;
  101. if(i==0) 
  102. break;
  103. }
  104. return null;
  105. }
  106. function SetCookie(name,value)
  107. {
  108. var argv=SetCookie.arguments;
  109. var argc=SetCookie.arguments.length;
  110. var expires=(2<argc)?argv[2]:null;
  111. var path=(3<argc)?argv[3]:null;
  112. var domain=(4<argc)?argv[4]:null;
  113. var secure=(5<argc)?argv[5]:false;
  114. document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
  115. }
  116. function setShowTime() {
  117. var today=new Date();
  118. var expireDate=new Date();
  119. // 保存一天
  120. expireDate.setTime(expireDate.getTime()+1000*60*60*24);
  121. SetCookie("weather_time", today.getTime(), expireDate);
  122. }
  123. function getShowTime() {
  124. var today = new Date();
  125. var r = 0;
  126. try{
  127. r = today.getTime();
  128. var t = parseInt(GetCookie("weather_time"))
  129. // 如果cookie不存在
  130. if (isNaN(t)) {
  131. setShowTime();
  132. r = 0;
  133. }
  134. else
  135. r = t;
  136. }
  137. catch(e){}
  138. return r;
  139. }
  140. // 根据cookie中记录的上次显示的时间,如果间隔超过1000*60*30半小时即再次显示预报
  141. function isShow() {
  142. var today = new Date();
  143. try {
  144. var lastTime = getShowTime();
  145. // alert(today.getTime()-lastTime);
  146. }
  147. catch (e) {}
  148. if (today.getTime()-lastTime>1000*60*30) {
  149. setShowTime();
  150. return true;
  151. }
  152. else
  153. return false;
  154. }
  155. </SCRIPT><DIV id=enetMeng 
  156. style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 241px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 500px; HEIGHT: 157px">
  157.   <TABLE WIDTH=255 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#E3FDEF">
  158.     <TR>
  159.       <TD height="26" align="center" valign="middle" background="<%=skinPath%>/images/bg1.gif"><span class="text_title"><%=Global.AppName%>&nbsp;-&nbsp;天气预报</span></TD>
  160.       <TD height="26" align="center" valign="middle" background="<%=skinPath%>/images/bg1.gif"><a href="javascript:enetcloseDiv()">×</a></TD>
  161.     </TR>
  162.     <TR>
  163.       <TD height="122" colspan="2" align="center" valign="middle"><%@ include file="58248.htm"%></TD>
  164.     </TR>
  165.   </TABLE>
  166. </div>
  167.                           
  168.