JS图片幻灯片效果与数据库链接的动态(两种)

第一种

 (1)需下载flashalter.swf 

 (2)test.jsp代码

              <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,cn.cmpy.company.*,java.util.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<jsp:useBean id="company" scope="page" class="cn.cmpy.company.company"></jsp:useBean>
<jsp:useBean id="comCtl" scope="page" class="cn.cmpy.company.comCtl"></jsp:useBean>
<jsp:useBean id="pkind" scope="page" class="cn.cmpy.company.pduKind"></jsp:useBean>
<jsp:useBean id="pkCtl" scope="page" class="cn.cmpy.company.productKind"></jsp:useBean>
<jsp:useBean id="news" scope="page" class="cn.cmpy.company.news"></jsp:useBean>
<jsp:useBean id="newsCtl" scope="page" class="cn.cmpy.company.newsCtl"></jsp:useBean>
<jsp:useBean id="product" scope="page" class="cn.cmpy.company.product"></jsp:useBean>
<jsp:useBean id="proCtl" scope="page" class="cn.cmpy.company.productCtl"></jsp:useBean>
 <%
  int newsid=pkCtl.getKindname("新闻动态");
  %>

     <%
   
ArrayList li=newsCtl.getNewspic(3,newsid);
int counts;
int i;
String[] Url=new String[5];
String[] text=new String[5];
String[] Link=new String[5];
%>
<%
counts=0;
for(Iterator it=li.iterator();it.hasNext();){
     news=(news)it.next();
  int aid=news.getId();
   Url[counts]="../"+(news.getPicurl()).trim();
     String title=news.getTitle().trim();
   if(title.length()>9){
     title=title.substring(0,9);
   }
   text[counts]=title;
   Link[counts]=("newsViews.jsp?newsid="+aid).trim();
  // out.print(Url[counts]+"<br>");
%>
<%
counts=counts+1;
}
%>
<a target=_self href="javascript:goUrl()">
                    <span class="f14b">
<script language="javascript">
 var imgUrl=new Array();
  var focus_width=145;
 var focus_height=140;
 var text_height=22;
 var swf_height = focus_height+text_height;
var pics="";
 var links="";
 var texts="";
  var countss="";

 imgtext=new Array();
 imgLink=new Array();
<%
for(int j=0;j<counts;j++){
%>
imgUrl[<%=j%>]=new Array("<%=Url[j]%>");

imgtext[<%=j%>]=new Array("<%=text[j]%>");

imgLink[<%=j%>]=new Array(escape("<%=Link[j]%>"));

<%
}

%>

<%
i=0;
while(i<counts){
   %>

   pics=pics+imgUrl[<%=i%>];
   links=links+imgLink[<%=i%>];
   texts=texts+imgtext[<%=i%>];
   countss=countss+<%=i%>;
 <%if(i!=(counts-1)){ %>
     pics=pics+"|";
  links=links+"|";
      texts=texts+"|";
   countss=countss+"|";
 <%
 }
 i=i+1;
 
 %>
  <%}%>
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width='+focus_width+'" height='+swf_height+'><param name="movie" value="swf/flashalter.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="scale" value="noscale" /><param name="salign" value="LT" /><param name="menu" value="false" />');
 document.write(' <param name="flashvars" value="PicWidth='+focus_width+'&PicHeight='+focus_height+'&MovieHeight='+swf_height+'&TextHeight='+text_height+'&TextBgColor=FFFFFF&PicUrls='+pics+'&UrlValue='+links+'&TextValue='+texts+'&Target=_blank&BordersWidth=1&RoundCorner=0&BordersColor=e5e5e5&BordersAlpha=100&TextFont=Arial&TextSize=12&TextBold=1&TextColor=CC1515&TextHoverColor=000000&TextLeftMargin=10&TextAlign=center&NumBgColor=000000&NumColor=FFFFFF&NumActiveColor=990000&NumBorderColor=FFFFFF&Effects='+countss+'" />');
 document.write('<embed src="swf/flashalter.swf" quality="high" flashvars="Author=Aslan&HomePage=http://www.aslan.cn/&PicWidth=273&PicHeight=310&MovieHeight=335&TextHeight=25&TextBgColor=FFFFFF&PicUrls='+pics+'&UrlValue='+links+'&TextValue='+texts+'&Target=_blank&BordersWidth=1&RoundCorner=0&BordersColor=e5e5e5&BordersAlpha=100&TextFont=Arial&TextSize=12&TextBold=1&TextColor=CC1515&TextHoverColor=000000&TextLeftMargin=10&TextAlign=center&NumBgColor=000000&NumColor=FFF57F&NumActiveColor=990000&NumBorderColor=FFFFFF&Effects='+countss+'" bgcolor="#ffffff" width="273" height="335" scale="noscale" salign="LT" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> '); 
document.write('</object>');
</script>
<span class="STYLE2"></span></span></a>
<span id=focustext class=f14b> </span>
</body>
</html>

第二种

 (1)需下载focus.swf

 (2)代码如下:

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,cn.cmpy.company.*,java.util.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<jsp:useBean id="company" scope="page" class="cn.cmpy.company.company"></jsp:useBean>
<jsp:useBean id="comCtl" scope="page" class="cn.cmpy.company.comCtl"></jsp:useBean>
<jsp:useBean id="pkind" scope="page" class="cn.cmpy.company.pduKind"></jsp:useBean>
<jsp:useBean id="pkCtl" scope="page" class="cn.cmpy.company.productKind"></jsp:useBean>
<jsp:useBean id="news" scope="page" class="cn.cmpy.company.news"></jsp:useBean>
<jsp:useBean id="newsCtl" scope="page" class="cn.cmpy.company.newsCtl"></jsp:useBean>
<jsp:useBean id="product" scope="page" class="cn.cmpy.company.product"></jsp:useBean>
<jsp:useBean id="proCtl" scope="page" class="cn.cmpy.company.productCtl"></jsp:useBean>
 <%
  int newsid=pkCtl.getKindname("新闻动态");
  %>

       <%
   
ArrayList li=newsCtl.getNewspic(3,newsid);
int counts;
int i;
String[] Url=new String[5];
String[] text=new String[5];
String[] Link=new String[5];
%>
<%
counts=0;
for(Iterator it=li.iterator();it.hasNext();){
     news=(news)it.next();
  int aid=news.getId();
   Url[counts]=(news.getPicurl()).trim();
     String title=news.getTitle().trim();
   if(title.length()>9){
     title=title.substring(0,9);
   }
   text[counts]=title;
   Link[counts]=("newsViews.jsp?newsid="+aid).trim();
  // out.print(Url[counts]+"<br>");
%>
<%
counts=counts+1;
}%>
<a target=_self href="javascript:goUrl()">
                    <span class="f14b">
<script type="text/javascript">
 var imgUrl=new Array();
 imgtext=new Array();
 imgLink=new Array();
<%
for(int j=0;j<counts;j++){
%>
imgUrl[<%=j%>]=new Array("<%=Url[j]%>");
imgtext[<%=j%>]=new Array("<%=text[j]%>");
imgLink[<%=j%>]=new Array(escape("<%=Link[j]%>"));
<%
}
%>
 var focus_width=145;
 var focus_height=140;
 var text_height=22;
 var swf_height = focus_height+text_height;
 var pics="";
 var links="";
 var texts="";
<%
i=0;
while(i<counts){
   %>
   pics=pics+imgUrl[<%=i%>];
   links=links+imgLink[<%=i%>];
   texts=texts+imgtext[<%=i%>];
 <%if(i!=(counts-1)){ %>
     pics=pics+"|";
  links=links+"|";
      texts=texts+"|";
 <%
 }
 i=i+1;
 %>
  <%}%>
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#Ffffff"">');
 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
 document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
 document.write('<embed src="http://www.webjx.com/htmldata/2005-10-01/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false"  quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
</script>
<span class="STYLE2"></span></span></a>
<span id=focustext class=f14b> </span></body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值