|
Well don't know how quick it really is but it will save you some trouble.  function quickDiv(ddisp,ccontent,parent,postype,ttop,lleft,rright,bbottom,bgcol,bgimg,btype,bamt,borcolor){ this.newdiv = document.createElement('div'); this.ddisp = ddisp; this.ccontent = ccontent; this.parent = parent; this.postype = postype; this.ttop = ttop this.lleft = lleft; this.rright = rright; this.bottom = bbottom; this.bgcol = bgcol; this.bgimg = bgimg; this.btype = btype; this.bamt = bamt; this.borcolor = borcolor; this.newdiv.style.display = this.ddisp; if(postype){ this.newdiv.style.position = this.postype; if(ttop){ this.newdiv.style.top = this.ttop; } if(lleft){ this.newdiv.style.left = this.lleft; } if(rright){ this.newdiv.style.right = this.rright; } if(bbottom){ this.newdiv.style.bottom = this.bbottom; }} if(bgcol){ this.newdiv.style.backgroundColor = this.bgcol; } if(bgimg){ this.newdiv.style.backgroundImage = 'url('+this.bgimg+')'; } if(btype && bamt && borcolor){ this.newdiv.style.border = this.btype+' '+this.bamt+' '+this.borcolor; } if(this.ccontent){ if(this.ccontent.nodeType){ this.newdiv.appendChild(this.ccontent); } else { this.newdiv.innerHTML = this.ccontent; }}} quickDiv.prototype.insertInto = function(){ if(this.parent && this.parent.nodeType){ this.parent.appendChild(this.newdiv); } else { document.body.appendChild(this.newdiv); }} It's used like: var myfastdiv = new quickDiv(properties); Then to append it myfastdiv.insertInto(); The parent doesn't have to exist if so the div gets appended to the body otherwise to the parent.  The content of it can be either be a node or a string. Just goof around with it allows for a lot of things divs use. I did this kind of quick so tell me if something is screwed up. 'Bout it.
|
Greg says: Coding music... Greg says: Hmm... Greg says: I wouldn't rule it out. Chris 3.0 [New features? Yes.] says:
 Greg says: If you think about machine code it's a bunch of 1s and 0s Chris 3.0 [New features? Yes.] says: Anything is possible. Greg says: Yeah try to code Metallica Chris 3.0 [New features? Yes.] says:
Yeah, I'll get right on that... right after I learn to fly.
|
|
|
|
this.ddisp = ddisp; this.ccontent = ccontent; this.parent = parent; this.postype = postype; this.ttop = ttop this.lleft = lleft; this.rright = rright; this.bottom = bbottom; this.bgcol = bgcol; this.bgimg = bgimg; this.btype = btype; this.bamt = bamt; this.borcolor = borcolor;
I think that part is kind of wasteful to be honest. =/
|
|
|
|
|