js创建对象的多种方式 1. 工厂模式 function createPerson(name) { var o = new Object() 0.name = name return o } var person1 = createPerson('xwk') 缺点:创造出来的对象无法识别,因为都指向同一个原型. 2. 构造函数模式 function Person(name) { this.name = name this.getName = function() { console.log(th…
效果: 代码: <head runat="server"> <title></title> <script type="text/javascript"> window.onload = function () { var otab = document.getElementById('tab1'); var thiscolor = ''; for (var i = 0; i < otab.tBodies[0].…