/// //页面类 //参数:jsonObj: Code -> 页面布局号,PanelCode -> 页标签ID,Layout -> 布局JSON数组对象 ND.Page = function(jsonObj) { this.hasData = this.hasData ? true : jsonObj ? true : false; if(jsonObj) { this.LayoutCode = jsonObj.Code; this.PanelCode = jsonObj.PanelCode; this.Display = jsonObj.IsShow ? "block" : "none"; this.Layout = jsonObj.Layout; } } //创建 ND.Page.prototype.Create = function(jsonObj) { ND.Page.apply(this, arguments); if(!this.hasData) { return; } var page = document.createElement("div"); page.id = "page_" + this.PanelCode; page.style.display = this.Display; page.className = "page"; page.setAttribute("layoutCode", this.LayoutCode); page.setAttribute("panelCode", this.PanelCode); var divItem; var clear; var width; for(var i = 0; i < this.Layout.length; i++) { divItem = document.createElement("div"); divItem.id = "page_" + this.PanelCode + "_" + i; divItem.className = "item"; divItem.style.width = this.Layout[i].Width && this.Layout[i].Width != "auto" ? this.Layout[i].Width : "auto"; clear = document.createElement("div"); clear.innerHTML = " "; clear.className = "clear"; divItem.appendChild(clear); page.appendChild(divItem); } divItem = document.createElement("div"); divItem.id = "pageClear"; divItem.className = "clear"; page.appendChild(divItem); document.getElementById("container").appendChild(page); } //加载页面布局 ND.Page.Load = function(str) { if(!str) { return; } var data = eval("(" + str + ")"); var page = new ND.Page(); page.Create(data); }
page
最新推荐文章于 2024-09-13 17:32:25 发布