PDA

View Full Version : [CLOSED] how to remove class to a tag add and a special class to a tag?



hdsoso
Feb 20, 2014, 12:35 AM
hi team
i want to remove all class="sc_sy" tag in a tag under ul.sc_nav, and add class="sc_sy" tag to the id="nav_4", how to do using ext.net or extjs?


<ul class="sc_nav">
<a id="nav_1" href="/" class="sc_sy" title="网站首页">网站首页</a>
<a id="nav_2" href="servs.aspx" title="服务内容">服务内容</a>
<a id="nav_3" href="cases.aspx" title="精彩案例">精彩案例</a>
<a id="nav_4" href="compcol.aspx?cid=48" title="新闻资讯">新闻资讯</a>
<a id="nav_5" href="about.aspx" title="关于奇卓">关于奇卓</a>
</ul>

geoffrey.mcgill
Feb 20, 2014, 3:07 AM
There are lots of options. The following demonstrates one technique.

Example


<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET Example</title>

<style type="text/css">
.red {
color: #f00;
}
</style>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button
runat="server"
Text="Change Css"
OnClientClick="Ext.get('nav_4').radioCls('red');"
/>

<ul>
<a id="nav_1" class="red">One</a>
<a id="nav_2">Two</a>
<a id="nav_3">Three</a>
<a id="nav_4">Four</a>
<a id="nav_5">Five</a>
</ul>
</form>
</body>
</html>

The documentation is your friend:

http://docs.sencha.com/extjs/

hdsoso
Feb 20, 2014, 3:36 AM
There are lots of options. The following demonstrates one technique.

Example


<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET Example</title>

<style type="text/css">
.red {
color: #f00;
}
</style>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button
runat="server"
Text="Change Css"
OnClientClick="Ext.get('nav_4').radioCls('red');"
/>

<ul>
<a id="nav_1" class="red">One</a>
<a id="nav_2">Two</a>
<a id="nav_3">Three</a>
<a id="nav_4">Four</a>
<a id="nav_5">Five</a>
</ul>
</form>
</body>
</html>

The documentation is your friend:

http://docs.sencha.com/extjs/

how about remove class? I can not find it in above url

geoffrey.mcgill
Feb 20, 2014, 4:24 AM
how about remove class? I can not find it in above url

The .removeCls function is two items below .radioCls.

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.dom.AbstractElement-method-radioCls

But, why would you need .removeCls if using .radioCls?