原文 http://blog.csdn.net/Teng_s2000/archive/2007/04/25/1584526.aspx
中imgInit已经改了,但是数字按钮自动走到最后一个就不走了,比如取记录5条,图片切换只切换到第四张就又从1开始了请高人帮我看一下。
JS贴不上去
中imgInit已经改了,但是数字按钮自动走到最后一个就不走了,比如取记录5条,图片切换只切换到第四张就又从1开始了请高人帮我看一下。
JS贴不上去
解决方案 »
- asp.net mvc3中IE的AJAX的问题
- vs2003+vss6.0的问题 WEB项目好卡 求救!!!
- 不知道怎么样做,也不知道有没有办法?????
- 帮帮忙,关于前后能值的问题,简单
- VS2005发布网站的问题?????????急!!
- 怎样可以禁止回发按钮的提交,因为我每次刷新就提交一次
- 怎么能让GridView的行高变小,和么能让从数据库里读出的的文字环绕图片
- 从数据库读取图片路径,前台滚动。 100分大出血
- 插入 regularExpressionValidator 未能完成操作,怎么回事?
- Asp.net中MD5算法加密的数据如何在ASP中得到验证?
- extjs grid如何绑定后台数据??
- [关于图表控件的简单问题]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.HtmlControls;
using System.Configuration;
//导入类----------------------using HuLangCms;//----------------------
public partial class Demo : System.Web.UI.Page
{
public string strPageTitle;//页面标题
public string S_Pic;//幻灯片图片
public string S_Title;//幻灯片标题
public string S_Link;//幻灯片连接
ClassDB DB = new ClassDB();
protected void Page_Load(object sender, EventArgs e)
{ strPageTitle = "ASP.NET幻灯片";
oViewFlash();
}
/// <summary>
/// Flash幻灯片
/// </summary>
private void oViewFlash()
{
string oFlashPic = "";
string oFlashLink = "";
string oFlashTitle = "";
SqlConnection myConn = DB.GetConnection();
string strSql = "Select Top 8 ID,PicName,PicLink,PicImg From Pic Order By Id Desc";
SqlCommand oIsCmd = new SqlCommand(strSql, myConn);
myConn.Open();
SqlDataReader sdr = oIsCmd.ExecuteReader();//查询,很明显可以看到 返回的是 SqlDataReader对象
while (sdr.Read())//使用SqlDataReader的 sdr.Read()方法读出数据
{
oFlashPic += sdr["PicImg"].ToString() + "|";
oFlashLink += sdr["PicLink"].ToString() + "|";
oFlashTitle += sdr["PicName"].ToString() + "|";
S_Pic = oFlashPic.Substring(0, oFlashPic.LastIndexOf("|"));
S_Title = oFlashTitle.Substring(0, oFlashTitle.LastIndexOf("|"));
S_Link = oFlashLink.Substring(0, oFlashLink.LastIndexOf("|"));
}
sdr.Close();
myConn.Close();
}
public string strFlash(string oNum)
{
string TopNum = "";
if (IsNumeric(oNum))
{
TopNum = " Top " + oNum + " ";
}
else
{
TopNum = " Top 5 ";
}
string strCode = "";
string oFlashPic = "";
string oFlashLink = "";
string oFlashTitle = "";
SqlConnection myConn = DB.GetConnection();
string strSql = "Select " + TopNum + " ID,PicName,PicLink,PicImg From Pic Order By Id Desc";
SqlCommand oIsCmd = new SqlCommand(strSql, myConn);
myConn.Open();
SqlDataReader sdr = oIsCmd.ExecuteReader();//查询,很明显可以看到 返回的是 SqlDataReader对象
if (sdr.Read())
{
strCode += "<script language=\"javascript\" type=\"text/javascript\">\r\n";
strCode += " var swf_width = 300;\r\n";
strCode += " var swf_height = 240;\r\n";
strCode += " var swf_path = '';\r\n";
strCode += " var files = '';\r\n";
strCode += " var texts = '';\r\n";
strCode += " var links = '';\r\n\r\n";
while (sdr.Read())//使用SqlDataReader的 sdr.Read()方法读出数据
{
oFlashPic += sdr["PicImg"].ToString() + "|";
oFlashLink += sdr["PicLink"].ToString() + "|";
oFlashTitle += sdr["PicName"].ToString() + "|";
S_Pic = oFlashPic.Substring(0, oFlashPic.LastIndexOf("|"));
S_Title = oFlashTitle.Substring(0, oFlashTitle.LastIndexOf("|"));
S_Link = oFlashLink.Substring(0, oFlashLink.LastIndexOf("|"));
} strCode += " files += '" + S_Pic + "';\r\n";
strCode += " texts += '" + S_Title + "';\r\n";
strCode += " links += '" + S_Link + "';\r\n\r\n"; strCode += " 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=\"' + swf_width + '\" height=\"' + swf_height + '\">');\r\n";
strCode += " document.write('<param name=\"movie\" value=\"' + swf_path + 'images/bcastr31.swf\">');\r\n";
strCode += " document.write('<param name=\"quality\" value=\"high\">');\r\n";
strCode += " document.write('<param name=\"menu\" value=\"false\">');\r\n";
strCode += " document.write('<param name=\"wmode\" value=\"opaque\">');\r\n";
strCode += " document.write('<param name=\"FlashVars\" value=\"bcastr_file=' + files + '&bcastr_link=' + links + '&bcastr_title=' + texts + '&TitleBgColor=6699FF\">');\r\n";
strCode += " document.write('<embed src=\"' + swf_path + 'images/bcastr31.swf\" wmode=\"opaque\" FlashVars=\"bcastr_file=' + files + '&bcastr_link=' + links + '&bcastr_title=' + texts + '&TitleBgColor=6699FF&\" menu=\"false\" quality=\"high\" width=\"' + swf_width + '\" height=\"' + swf_height + '\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');\r\n";
strCode += " document.write('</object>');\r\n";
strCode += "</script>\r\n";
}
else
{
strCode = "没有数据!";
}
sdr.Close();
myConn.Close();
return strCode;
}
/// <summary>
/// 判断是否为数字
/// </summary>
/// <param name="txt">字符串</param>
/// <returns></returns>
public bool IsNumeric(string txt)
{
if (txt != "")
{
int i = 0;
bool result = int.TryParse(txt, out i);
if (result)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}.aspx页面调用:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Demo.aspx.cs" Inherits="Demo" %>
<!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 runat="server">
<title><%=strPageTitle%></title>
</head>
<body>
<%=strFlash("3")%>
</body>
</html>images/bcastr31.swf文件下载:http://www.newasp.net/images/bcastr31.swf实在不知道咋搞。发你邮箱。我发你
改成
<%=strFlash("4")%>看一下
http://topic.csdn.net/u/20100409/10/48899021-38ec-4ffb-978a-cf2796071a49.html