首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:Javascript 参考手册
TRY RUN / 在线示例
Javascript 参考手册 尝试一下
Javascript 参考手册 尝试一下
源代码
运行
<!DOCTYPE html> <html> <head> <script> function floatRight() { document.getElementById("img1").style.cssFloat="right"; } function floatLeft() { document.getElementById("img1").style.cssFloat="left"; } </script> </head> <body> <img id="img1" src="w3javascript.gif" width="100" height="132"> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <input type="button" onclick="floatRight()" value="Float right"> <input type="button" onclick="floatLeft()" value="Float left"> </body> </html>
运行结果