Post Archive

› November 7, 2005

Filler text on demand

  • Reported by Alessandro

While preparing a series of articles on CSS layouts, I felt the need of a simpler way than editing the markup to fill up page elements to test them. So I developed a very short script that I find very handy, and I'd like to present here.

Basically the script appends on demand a filler text through functional links added via javascript... but it's easier to see than explain, so here it goes the example page I prepared.

The script is quite short, almost DOM-based and most of all unobtrousive. For its usage no javascript knowledge and no modification are necessary. If you look at the HTML of the example page there are just few lines in the head section that enable a filler text on demand, as is:

<script type="text/javascript" src="ftod.js"></script>
<script type="text/javascript">
window.onload=function(){
    AddFillerLink("content","navigation");
    }
</script>

In order to use the filler script, simply copy the script in the same folder of the pages you want to test and paste the above lines in the head section. The only part that probably you'd want to change are the sections to fill, wich are identified by id attribute in the markup and in the case of the above code are in bold. Any number of IDs is accepted, just be sure to put them between quotes and separate them by commas and you've done.

Comments

1. November 8, 2005 03:50 AM

Quote this comment

Anders Rasmussen Posted…

Nice little feature - all we need now, is a RemoveFillerLink() function as the cherry on top :-)

2. November 8, 2005 09:28 AM

Quote this comment

steve Posted…

Nice little feature, my only question is why is it that your sample page keeps the columsn the same length, and mine doesn't - even if I use your entire source? What am I missing?

3. November 8, 2005 09:50 AM

Quote this comment

Alessandro Fulciniti Posted…

Steve, in the example I simply used the Faux Columns method, hence a background image to mimic the effect of columns of the same length.

4. November 8, 2005 08:18 PM

Quote this comment

steve Posted…

gotcha, thanks.

5. November 22, 2005 04:48 PM

Quote this comment

Silus Grok Posted…

Hey everyone... this is a great idea, but I thought I'd take a whack at creating a filler text script solution myself... mostly because I was concerned that using IDs to invoke the javascript would be unweildy for folks who use IDs extensively.

6. March 2, 2006 07:04 PM

Quote this comment

Posted…

Absolutely sweet, but... what about the simplicity of no tags such as developed by silusGROK ?
As #1 reply (Anders Rasmussen ) said:
a RemoveFillerLink()      function as the cherry on top :-)

7. March 24, 2006 02:06 PM

Quote this comment

ranjan Posted…

Remove Filler Link added: http://www.areweawake.com/entertainment/filler.html