Make sure the element you are floating is smaller than the available width-
and ‘float’ cannot be a property identifier in javascript (style.float)- use styleFloat and cssFloat,
or set the css string ‘float:left’ or ‘float:right’.
<!doctype html>
<head>
<title>refloat</title>
<style>
#logoholder{
float: left;
width:45%;
border: 1px solid #666666;
}
</style>
<script>
function logoplace(e){
e= e || window.event;
var which= e.target || e.srcElement;
if(which && which.value){
document.getElementById('logoholder').style.cssText= 'float:'+which.value;
}
}
window.onload= function(){
document.getElementById('choosefloat').onclick= logoplace;
}
</script>
</head>
<body>
<fieldset id="choosefloat">
<legend>Float the test div</legend>
<label><input type= "radio" name= "logoplacement" value= "left" checked>Left</label>
<label><input type= "radio" name= "logoplacement" value= "right" >Right</label>
</fieldset>
<div id= "logoholder"> This is a test</div>
</body>
</html>