摘要:<!DOCTYPE html> <html> <head> <title>JavaScript控制DIV样式</title> <meta charset="utf-8"> <style type="text/css"> #box{wid
<!DOCTYPE html> <html> <head> <title>JavaScript控制DIV样式</title> <meta charset="utf-8"> <style type="text/css"> #box{width: 100px;height: 100px;background-color: red;margin: 20px 40px;} </style> </head> <body> <div id="box"></div> <input type="button" name="变高" value="变高" onclick="aa()"> <input type="button" name="变高" value="变宽" onclick="bb()"> <input type="button" name="变高" value="恢复" onclick="cc()"> <input type="button" name="变高" value="变色" onclick="dd()"> <script type="text/javascript"> var box window.onload=function() { box=document.getElementById('box') } function aa(){ box.style.height="400px" } function bb(){ box.style.width="400px" } </script> </body> </html>
批改老师:灭绝师太批改时间:2019-01-15 09:07:30
老师总结:案例这么简单,你还没有做全面,不应该啊,必要的地方敲上备注哦!