<script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ function set_borderTop(id) { var borderTop ={ "div1":"5px solid #FF0000", "div2":"5px solid #FFFF00", "div3":"5px solid #0000CD" } for(var k in borderTop) document.getElementById(k).style.borderTop="" document.getElementById(id).style.borderTop=borderTop[id] } /*]]>*/ </script>
<div id="div1" onclick="set_borderTop(this.id)"></div> <div id="div2" onclick="set_borderTop(this.id)"></div> <div id="div3" onclick="set_borderTop(this.id)"></div>