ASP.net连接数据库实现图片轮换
前台代码:
<script type="text/javascript">
<%=LoadImage() %>
imgUrl1="uploads/"+ImgSrc[0];
imgtext1=ImgAlt[0]
imgLink1=escape("adimg.aspx?Img_ID="+ImgUrl[0]);
imgUrl2="uploads/"+ImgSrc[1];
imgtext2=ImgAlt[1]
imgLink2=escape("adimg.aspx?Img_ID="+ImgUrl[1]);
imgUrl3="uploads/"+ImgSrc[2];
imgtext3=ImgAlt[2]
imgLink3=escape("adimg.aspx?Img_ID="+ImgUrl[2]);
imgUrl4="uploads/"+ImgSrc[3];
imgtext4=ImgAlt[3]
imgLink4=escape("adimg.aspx?Img_ID="+ImgUrl[3]);
imgUrl5="uploads/"+ImgSrc[4];
imgtext5=ImgAlt[4]
imgLink5=escape("adimg.aspx?Img_ID="+ImgUrl[4]);
var focus_width=588
var focus_height=254
var text_height=18
var swf_height = focus_height+text_height
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5
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="#F0F0F0">');
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('</object>');
</script>
后台代码:
//图片新闻
protected string LoadImage()
{
string sql = string.Forma
相关文档:
asp.net 密码回传后,不见 的解决办法
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
& ......
对“添加”、“提交”、“保存”、“更新”等按钮需要对数据库进行写操作的按钮,一定要在页面初始化时加载脚本,防止多次重复点击,例如:
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0以上
......
一、(单值绑定)在页面的后台代码中定义公有变量,如下:
public string gongYou = "声明的公有成员";
①然后在页面的源中调用,如下:
<asp:Label ID="lblMgs" runat="server" Text="<%#gongYou >"></asp:Label>
②当然最后要记得绑定数据:
protected void Page_Load(object ......