调用不同的CSS

hxf66888 2009-03-18 11:58:57
现有两个DIV样式 AA BB
默认显示AA

点But1 经过后台数据计算后,将信息显示在DIV 应用BB
点But2 应用AA

请教高手如何实现?
...全文
80 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
盛米网络 2009-03-18
  • 打赏
  • 举报
回复

//类似这样的思路
if(Request.QueryString["div"]!=null)
{
switch (Request.QueryString["div"].ToString())
{
case "2":
{
this.t2_layer_1.Attributes.Add("style", "display:none;");
this.t2_layer_2.Attributes.Add("style", "display:block;");
this.t2_layer_3.Attributes.Add("style", "display:none;");
this.t2_layer_4.Attributes.Add("style", "display:none;");
this.t2_layer_5.Attributes.Add("style", "display:none;");
this.t2_item_1.Attributes.Add("class", "infoCategories_item");
this.t2_item_2.Attributes.Add("class", "infoCategories_item_show");
this.t2_item_3.Attributes.Add("class", "infoCategories_item");
this.t2_item_4.Attributes.Add("class", "infoCategories_item");
this.t2_item_5.Attributes.Add("class", "infoCategories_item");
break;
}
case "3":
{
this.t2_layer_1.Attributes.Add("style", "display:none;");
this.t2_layer_2.Attributes.Add("style", "display:none;");
this.t2_layer_3.Attributes.Add("style", "display:block;");
this.t2_layer_4.Attributes.Add("style", "display:none;");
this.t2_layer_5.Attributes.Add("style", "display:none;");
this.t2_item_1.Attributes.Add("class", "infoCategories_item");
this.t2_item_2.Attributes.Add("class", "infoCategories_item");
this.t2_item_3.Attributes.Add("class", "infoCategories_item_show");
this.t2_item_4.Attributes.Add("class", "infoCategories_item");
this.t2_item_5.Attributes.Add("class", "infoCategories_item");
break;
}
}
}
hxf66888 2009-03-18
  • 打赏
  • 举报
回复
不好意思,我是想问:
在点But1及But2时,如何指定DIV的Class 值.
sunzhong2003 2009-03-18
  • 打赏
  • 举报
回复
.style.className="";
wenblue7 2009-03-18
  • 打赏
  • 举报
回复
用表示啊

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧