<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> #main{ width:100px; height:100px; background:red; float:right;} </style> </head> <body> <div id="main"> </div> </body> </html> <script> window.οnlοad=function() { var oMain=document.getElementById("main"); //oMain.style.float="left";X错的 oMain.οnclick=function(){ oMain.style.cssFloat="left";//非IE浏览器可行 oMain.style.styleFloat="left";//IE浏览器可行 } </script>