2014-11-01 90 views
0

我需要在点击时将类样式属性颜色的值从红色更改为绿色。Onclick更改类样式值而不更改类名称

<style> 
.c1 
{ 
color : RED; 
} 

</style> 

<a id="a1" class="c1" onclick="changeclassstyle()"> 
Hi 
</a> 

<script> 
function changeclassstyle() 
{ 
/* here i need to change the style of class c1 */ 
} 
</script> 

我需要将c1类的颜色更改为绿色。

注:我希望它与“ID” &我要创建新和更改类名来完成。我希望它发生在相同的类名。

+0

你的意思是想改变''