程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> 圖片輪換

圖片輪換

編輯:.NET實例教程

<script language="Javascript" type="text/Javascript">
 var focus_width=250
var focus_height=170
var text_height=24
var swf_height = focus_height+text_height
var pics=<%=pics %>;
var links=<%=links %>;
var texts=<%=texts %>;
//var pics = ''images/01.jpg|images/02.jpg|images/03.jpg|/School/UploadFiles_7810/201104/20110420074548484.jpg'';
//var links = ''viewthread.php?tid=881|viewthread.php?tid=1171|viewthread.php?tid=977|viewthread.php?tid=531|viewthread.php?tid=838|vIEwthread.PHP?tid=899'';
//var texts = ''觸發驗證問題!求助|分頁調查系統如何保存所有數據?|[A027]XML數據島(羅維原創)|關於tabcontrol控件|[A149]ASP.Net 導航控件(xialei222原創)|[A152]新聞發布系統四(hanxiao原創)'';
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/pixvIEwer.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="images/pixvIEwer.swf" wmode="opaque" FlashVars="pics=''+pics+''&links=''+links+''&texts=''+texts+''&borderwidth=''+focus_width+''&borderheight=''+focus_height+''&textheight=''+text_height+''" menu="false" bgcolor="#FFFFFF" 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> 

 

後台的代碼:

 public string pics = "";
    public string links = "";
    public string texts = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=526842;database=test");
        con.Open();
        string sqlstr = "select top 4 * from Note order by id desc";
        SqlCommand cmd = new SqlCommand(sqlstr, con);
        SqlDataReader re = cmd.ExecuteReader();
        if (re.Read())
        {
            pics = "''" + "images/" + re["pics"].ToString();
            links = "''" + "show.ASPx?id" + re["id"].ToString();
            texts = "''" + re["texts"].ToString();
        }
        while (re.Read())
        {

            pics = pics + "|" + "images/" + re["pics"].ToString();
            links = links + "|" + "show.ASPx?id" + re["id"].ToString();
            texts = texts + "|" + re["text

s"].ToString();
        }
        pics = pics + "''";
        links = links + "''";
        texts = texts + "''";


    }

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved