<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="智能社 - zhinengshe.com"> <meta name="copyright" content="智能社 - zhinengshe.com"> <title>智能社 - www.zhinengshe.com</title> <style> #div1 { width:200px; height:200px; border:5px solid red; } </style> <script> window.onload=function (){ var oDiv=document.getElementById(‘div1‘); setStyle(oDiv, { ‘width‘ : ‘500px‘, ‘height‘: ‘500px‘, ‘border‘:‘20px solid blue‘ }); }; function setStyle(obj, json) { for (var i in json) { obj.style[i]=json[i]; } } </script> </head> <body> <div id="div1"></div> </body> </html>
时间: 2024-11-06 11:07:36