标签:creat 包括 body prot title define prototype undefined document
1 <!doctype html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <script> 9 function CreateDiv(){ 10 this.m_Text=‘Hi,welcome‘; 11 this.m_Element = document.createElement(‘div‘); 12 this.m_Element.innerHTML=this.m_Text; 13 this.m_Element.onclick=this.func; 14 } 15 CreateDiv.prototype.Render= function () { 16 document.body.appendChild(this.m_Element); 17 } 18 CreateDiv.prototype.func=function(){ 19 alert(this.m_Text); 20 }; 21 var cd = new CreateDiv(); 22 cd.Render(); //undefined 23 </script> 24 </body> 25 </html>
标签:creat 包括 body prot title define prototype undefined document
原文地址:http://www.cnblogs.com/coldfishdt/p/6082297.html