HighDots Forums  

Coloring layers for easier layout

Website Design comp.infosystems.www.authoring.site-design


Discuss Coloring layers for easier layout in the Website Design forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark
 
Posts: n/a

Default Coloring layers for easier layout - 12-22-2005 , 10:22 AM






Howdy.

Here's a Javascript function I wrote to automatically add different
background colors to each DIV layer on a page. I find it useful
for fine-tuning layout during development. It's a lot easier than
hard-coding the background colors and then removing them.

Ok, it's trivial. But this should save _someone_ from having to
write it. Enjoy.

-Mark

----------------------------------
function color_layers()
{
// This function adds background colors to all DIV layers
// for easier layout during development.
var colors = new Array("red","blue","green","yellow","orange","brow n",
"gray","purple","teal","fuchsia","lime","maroo n",
"navy","olive","silver");
var c = 0;
var i = 0;
var divs = document.getElementsByTagName("div");
for (i=0;i<divs.length;i++)
{divs[i].style.backgroundColor = colors[c];
c==colors.length-1?c=0:c++;
}
}




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.