any column longest struggle - helper script
Posted: Sun 4. Nov 2007, 15:31
Put into your page's head:
The AddFillerLink (is it an array?) contains the names of your div ids (eg #content-right becomes "content-right" then)
It doesn't work with classes...
Save the following (beeing referenced within page head) as "flod.js"
At the top of the script is the source of it for further reading.
I find this extremly useful (had a real fight recently to get a construction working but this one has been a real helper
claus
Code: Select all
<script type="text/javascript" src="flod.js"></script>
<script type="text/javascript">
window.onload=function(){
AddFillerLink("content-right","content-left","contentmain-right","contentmain-left","innerbox2-content","navigation-left");
}
</script>
It doesn't work with classes...
Save the following (beeing referenced within page head) as "flod.js"
Code: Select all
//filler text on demand
// http://web-graphics.com/mtarchive/001667.php
var words=new Array("filler","text","silly","very","fill","make","short","long","column","test","dasauchnoch");
function AddFillerLink(){
if(!document.getElementById || !document.createElement) return;
var i,l;
for(i=0;i<arguments.length;i++){
l=document.createElement("a");
l.href="#";
l.appendChild(document.createTextNode("Add Text to this section"));
l.onclick=function(){AddText(this);return(false)};
document.getElementById(arguments[i]).appendChild(l);
}
}
function AddText(el){
var s="",n,i;
n=RandomNumber(200,800);
for(i=0;i<n;i++)
s+=words[RandomNumber(0,words.length-1)]+" ";
var t=document.createElement("p");
t.appendChild(document.createTextNode(s));
el.parentNode.insertBefore(t,el);
}
function RandomNumber(n1,n2){
return(Math.floor(Math.random()*(n2-n1))+n1);
}
I find this extremly useful (had a real fight recently to get a construction working but this one has been a real helper
claus