新手提问--动态改变链接地址
<a id= "ImgLink " href= "http://news.qq.com " target= "_blank " >
<asp:Image ID= "Image1 " runat= "server " BorderStyle= "None " ImageUrl= "~/3830699.jpg " />
</a>
比如这个,点击这个图片链接到一个网站,现在我想在程序中动态设置这个链接的地址,该怎么做?
谢谢!
------解决方案-------------------- private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Random RD = new Random();
int i = RD.Next(0,100);
if(i <=10)
{
Response.Write( "window.open( '地址一 ') ");
}
else if(i> 10 && i <=20)
{
Response.Write( "window.open( '地址二 ') ");
}
//...
else
{
Response.Write( "window.open( '地址N ') ");
}
}