求助 CSS 问题
......
protected void CreateImage()
{
for (int m = 0; m < 3; m++)
{
ImageButton bt = new ImageButton();
bt.CssClass = "img";
bt.Width = 71;
bt.Height = 96;
bt.ImageUrl = "i/" + m.ToString() + ".jpg";
bt.Click += new ImageClickEventHandler(bt_Click);
Panel1.Controls.Add(bt);
}
}
void bt_Click(object sender, ImageClickEventArgs e)
{
ImageButton bt = (ImageButton)sender;
string ss = bt.ImageUrl;
if (bt.CssClass == "imagebutton")
bt.CssClass = "img";
else
bt.CssClass = "imagebutton";
}
按钮数为1时运行正常,多个时无效。