JS adds multiple styles to an element, the quickest and easiest thing to do is to use the Csstext property, but it overrides the value of the entire style, and to retain the original style style value, it's simple, as in the example above, to record the original style value with a variable, and then do a concatenation of the strings.
<a href= "javascript:;" id= "Test" style= "Font-size:25px;background: #080;" > Test 3</a>
<script>
var Obj=document.getelementbyid ("Test");
var Oldstyle=obj.style.csstext;
alert (Oldstyle);
obj.style.csstext= "border:2px Red Solid;color: #f00;" +oldstyle;
</script>
But note: IE8 and the following browser Obj.style.cssText returned the last style value is not semicolon, in the form of: Font-size:25px;background: #080. Just want to say, ie as always make people feel uncomfortable, hehe.
In the example, the intent is to place the oldstyle behind the string concatenation, this concatenation of the style string even if the last style value does not have a semicolon, there will be no problem, the browser style application display is consistent, this is a small skill, there is no technical content, but easy to ignore or forget, know that their memory is bad, Mark, ^_^.