<html> <body> <div> <div id="float1" style="border: 2px solid red; height:100px">I should become a right-floating element.</div> This text should be on the left. The float should be to the right. </div> </div> <div style="height:30px"></div> <div> <span id="float2" style="border:2px solid red; height:100px">I should become a left-floating element.</span> This text should be on the right. The float should be to the left. </div> <script> document.getElementById("float1").style.cssFloat = 'right'; document.getElementById("float2").style.cssFloat = 'left'; </script>