<html>
<head>
</head>
<body>
<div id="black" style="background: black; float: right">foo</div>
<div id="red" style="background: red; float: left">foo</div>
<br>
<br>
<br>
<button id="swap">swap</button>
<script>
swap.onclick=function(){
var right=black.style.cssFloat==="right"? black : red
var left=black.style.cssFloat==="left"? black : red
right.style.cssFloat="left"
left.style.cssFloat="right"
}
</script>
</body>
</html>