Или так...
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
.box {
height: 50px;
margin: 5px;
}
.xxx {
background: blue;
}
.yyy {
background: red;
}
</style>
<script type="text/javascript">
function replaceClass() {
$('.xxx').removeClass('xxx').addClass('yyy');
};
</script>
</head>
<body>
<div class="box xxx"></div>
<div class="box xxx"></div>
<div class="box xxx"></div>
<div class="box xxx"></div>
<div class="box xxx"></div>
<button onclick='replaceClass();'>test</button>
</body>
</html>