封装一些简单的 dom 操作
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .div{ color:yellow; padding:30px; font-size:80px } </style> </head> <body> <div id='div'> </div> </body> </html> <script src='itcast.js'></script> <script> // 不用框架的时候 // var div = document.getElementById('div') // div.style.background='red' // div.name='mydiv' // div.className = 'div' // div.innerHTML= '欢迎进入魔兽世界' var div = $$.$id('div') $$.css('div','background','red') $$.attr('div','name','mydiv') $$.attr('div','className','div') $$.html('div','欢迎进入魔兽世界') </script>