Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ppElement=function(str_elmt){
- this.tagName=str_elmt;
- return this.ppCreate();
- };
- ppElement.prototype={
- constructor:ppElement,
- ppCreate:function(){
- return document.createElement(this.tagName);
- },
- ppAppend:function(){
- var prntObj=arguments[0];
- for(var i=1;i<arguments.length;i++){
- prntObj.appendChild(arguments[i]);
- }
- },
- ppSetStyle:function(){
- var prntObj=arguments[0];
- prntObj.style.cssText=arguments[1];
- },
- ppWrapper:function(){
- var wrapper_Obj=ppElement.call(this,"div");
- var child_Obj=[];
- child_Obj[0]=wrapper_Obj;
- for(var i=0,j=1;i<arguments.length;i++,j++){
- child_Obj[j]=arguments[i];
- }
- this.ppAppend.apply(this,child_Obj);
- return wrapper_Obj;
- }
- };
- var ppTable=function(row_int,coloumn_int){
- this.row=row_int;
- this.coloumn=coloumn_int;
- return this.ppCreateTable();
- };
- ppTable.prototype=Object.create(ppElement.prototype,{
- constructor:ppTable,
- ppCreateTable:{
- value:function(){
- var tableObj=ppElement.call(this,"div");
- for(var i=0;i<this.row;i++){
- var tableRowObj=ppElement.call(this,"div");
- for(var j=0;j<this.coloumn;j++){
- var tableColumnObj=ppElement.call(this,"div");
- this.ppAppend(tableRowObj,tableColumnObj);
- }
- this.ppAppend(tableObj,tableRowObj);
- }
- return tableObj;
- }
- },
- tableCell:{
- value:function(){
- alert("hi");
- }
- }
- });
- var testTable=new ppTable(2,2);
- testTable.tableCell();
- document.getElementsByTagName('body')[0].appendChild(testTable);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement