C# 动态更改页面的背景图像
我想动态更改页面的背景图像。 我的aspx页面中的代码是:C# 动态更改页面的背景图像,c#,asp.net,C#,Asp.net,我想动态更改页面的背景图像。 我的aspx页面中的代码是: <li style="background:url(/newtheme/images/city-images/City-name.jpg) no-repeat center 93px;"></li> /newtheme/images/city images/这部分URL是staic 而City-name.jpg将不断变化,如California.jpg、Dubai.jpg等 请帮忙, 如果您想在服务器端执行
<li style="background:url(/newtheme/images/city-images/City-name.jpg) no-repeat center 93px;"></li>
/newtheme/images/city images/这部分URL是staic
而City-name.jpg将不断变化,如California.jpg、Dubai.jpg等
请帮忙,
如果您想在服务器端执行此操作,请给您的LI一个ID和runat=“server”属性,谢谢:
<li runat="server" id="liCity"></li>
使用JavaScript或将其设置为服务器端控件,在其中设置样式属性请告诉我如何创建服务器端控件
liCity.Style["background"] = string.Format("url(/newtheme/images/city-images/{0}.jpg) no-repeat center 93px;", "Moscow");