JS变量1
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <style type="text/css"> 7 #div1{ 8 width: 200px; 9 height: 50px; 10 background-color: orange; 11 } 12 </style> 13 <script type="text/javascript"> 14 function toGreen(){ 15 var a=document.getElementById('div1'); 16 a.style.background='green'; 17 a.style.width='300px'; 18 a.style.height='100px'; 19 } 20 function toOrange(){ 21 var a=document.getElementById('div1'); 22 a.style.background='orange'; 23 a.style.width='200px'; 24 a.style.height='50px'; 25 } 26 </script> 27 </head> 28 <body> 29 <div id="div1" onmouseover="toGreen()" onmouseout="toOrange()"></div> 30 </body> 31 </html>