x
 
<!DOCTYPE html>
<html>
<body>
<img id="myImg" src="/i/pic/w3logo.png" width="180" height="167">
<p>这是一个段落。</p>
<p>这是另一个段落。</p>
<button type="button" onclick="floatRight()">向右浮动</button>
<button type="button" onclick="floatLeft()">向左浮动</button>
<script>
function floatRight() {
  document.getElementById("myImg").style.cssFloat = "right";
}
function floatLeft() {
  document.getElementById("myImg").style.cssFloat = "left";
}
</script>
</body>
</html>