<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script type="text/javascript">
$(function() {
$("span:not('#a, #c')").css("background", "yellow");
});
</script>
<span id="a">text1</span>
<span id="b">text2</span>
<span id="c">text3</span>