---
title: "Ext Extends test"
author: "hcmfys"
date: "2009-11-06T17:33:00Z"
tags: ["CSS", "EXT", "HTML", "JavaScript", "prototype"]
slug: "ext-extends-test"
draft: false
lastmod: "2009-11-06T17:33:00Z"
id: 588778
url: "https://hcmfys.iteye.com/blog/588778"
---

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;  
&lt;html&gt;  
    &lt;head&gt;  
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;  
        &lt;title&gt;js&lt;/title&gt;  
        &lt;style&gt;  
              
            .btUi {  
                border: solid 1px green;  
            }  
        &lt;/style&gt;  
        &lt;link type="text/css" media="all" rel="Stylesheet" href="http://localhost:80/wratry/Ext/css/ext-all.css" /&gt;  
        &lt;script src="http://localhost:80/wratry/Ext/ext-base.js" type="text/javascript"&gt;  
        &lt;/script&gt;  
        &lt;script src="http://localhost:80/wratry/Ext/ext-all.js" type="text/javascript"&gt;  
        &lt;/script&gt;  
    &lt;/head&gt;  
    &lt;body&gt;  
        &lt;div id='java'&gt;  
        &lt;/div&gt;  
        &lt;script language="JavaScript" type="text/javascript"&gt;  
            Ext.onReady(function(){  
                Ext.namespace("sp.studio");  
                sp.studio.ListDiv = Ext.emptyFn;  
                sp.studio.ListDiv = function(cfg){  
                    Ext.apply(this, cfg);  
           //   Ext.extend(this,Ext.Window,{});  
                    this.init(cfg.el);  
                };  
                Ext.apply(sp.studio.ListDiv.prototype, {  
                    El: function(){  
                        return Ext.get(this\['el']);  
                    },  
                    setWidth: function(width){  
                         this.El().dom.style.width = width + "px";  
                    },  
                    setHeight: function(height){                      
                         this.El().dom.style.height = height + "px";  
                    },  
                    setClass: function(cls){  
                      this.El().dom.className = cls;  
                    },  
                    rendererTo: function(){  
                        for (var i in this) {  
                            if (i == 'width') {  
                                this.setWidth(this\[i]);  
                            }  
                            if (i == 'height') {  
                                this.setHeight(this\[i]);  
                            }  
                            if (i == 'cls') {  
                                this.setClass(this\[i]);  
                            }  
                        }  
                    },  
                    init: function(el){  
                        if (el) {  
                            this.rendererTo();  
                        }  
                    }  
                });  
                var t = new sp.studio.ListDiv({  
                    width: 100,  
                    height: 200,  
                    cls: 'btUi',  
                    el: 'java',  
                });  
                t.renderTo('java');  
                t.show();  
                //t.rendererTo("java");         
            });  
        &lt;/script&gt;  
    &lt;/body&gt;  
&lt;/html&gt;