在javascript中设置特定单词的样式
我正在使用Milonic菜单开发一个菜单系统,需要在菜单中设置特定的单词来改变样式。例如,在代码中在javascript中设置特定单词的样式,javascript,Javascript,我正在使用Milonic菜单开发一个菜单系统,需要在菜单中设置特定的单词来改变样式。例如,在代码中 with(SampStyle=new mm_style()){ bordercolor="#000000"; borderstyle="solid"; borderwidth=0; fontfamily="Amaranth, sans serif"; fontsize="17px"; fontstyle="normal"; fontweight="normal"; align='center';
with(SampStyle=new mm_style()){
bordercolor="#000000";
borderstyle="solid";
borderwidth=0;
fontfamily="Amaranth, sans serif";
fontsize="17px";
fontstyle="normal";
fontweight="normal";
align='center';
offbgcolor="#000000";
offcolor="#ffffff";
onbgcolor="#333333";
oncolor="#ffffff";
pagecolor="#aaffaa";
padding=5;
itemwidth="100px";
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
top=0;
itemwidth="1%";
position:"relative;"
top=230;
/*left=199;*/
screenposition="center";
menuwidth="834px"; /* was 85%, to fit on page 70% -->68% */
/*screenposition="middle;center";
top="offset=-40";*/
orientation="horizontal";
style=SampStyle;
aI("text=Home;url=http://www.moe365.org/;");
aI("showmenu=News;text=News;url=http://moe365.org/news.php;");
aI("showmenu=FIRST Robotics;text=FIRST;url=http://www.moe365.org/whatisfirst.php;");
aI("showmenu=The Team;text=The Team;url=http://moe365.org/team.php;");
aI("showmenu=Media;text=Media;url=http://www.moe365.org/media.php;");
aI("showmenu=Competitions;text=Competitions;url=http://moe365.org/competitions.php;");
aI("showmenu=Robot History;text=Robots;url=http://moe365.org/history.php;");
aI("showmenu=Sponsors;text=Sponsors ;url=http://moe365.org/sponsors.php;");
aI("showmenu=Resources;text=Resources;url=http://moe365.org/resources.php;");
}
我需要先用这个词来改变风格。任何帮助都将不胜感激。以单词为目标,在jQuery中使用.addClass,如下所示:
/* etc */
yourWord.addClass("colorClass");
/* etc */
链接参考:
或者将单词包装在span标记中,如下所示:
<span class="colorClass">FIRST</span>
这对我不起作用,你还有其他想法吗?
.colorClass {
color:red; /* or the color you want */
}