fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <style> #myDIV{ border:1px solid black; width:300px; height:300px; background:url('smiley.gif') no-repeat; } </style> </head> <body> <p>点击“尝试一下”按钮扩大 DIV 元素的背景大小:</p> <button onclick="myFunction()">尝试一下</button> <div id="myDIV"> <h1>Hello</h1> </div> <script> function myFunction(){ document.getElementById("myDIV").style.backgroundSize = "60px 120px"; } </script> </body> </html>
运行结果