Un message traversant votre fenêtre en Zig-Zag

 Téléchargez ici le script ( 1,54 Ko )

En fonction de la résolution d'écran il est possible que vous n'aperceviez pas la totalité de cette page conçus pour le 600X800

  1 - Copiez et collez entre les balises <head> et </head> :

<script>
<!-- Début du Script -
// CONFIGURATION:
// votre message. Attention: les longs messages ralentissent le script!
var your_message="BONJOUR !"
// police
var textfont="Verdana"
// taille de la police
var textsize=20
// couleur de la police
var textcolor="CCFFCC"
// hauteur de la police (boldness). Choisir une taille comprise entre 1 et 9
var textboldness=7
// vitesse
var tempo=40
// average horizontal distance between the letters
var stepx=30
// average vertical distance between the letters
var stepy=20
// ne pas éditer les données ci-dessous
var msg=new Array()
var msg=your_message
var message=msg.split("")
var numberofletters=msg.length-1
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
textboldness=textboldness*100
var timer
var xpos=new Array()
var ypos=new Array()
var spancontent=new Array()
for (i=0; i<=numberofletters;i++) {
xpos[i]=0
ypos[i]=0
}
for (i=0;i<=numberofletters;i++) {
spancontent[i]="<span style='position:relative;font-family:"+textfont+";font-size:"+textsize+"pt;color:"+textcolor+";font-weight:"+textboldness+"'>"+message[i]+"</span>"
}
function setValues() {
var firsttimer= setTimeout("setValues2()",2000)
}
function setValues2() {
if (document.all) {
marginbottom = document.body.clientHeight-5
marginright = document.body.clientWidth-5
for (i=0;i<=numberofletters;i++) {
var thisspan = eval("document.all.span"+i)
thisspan.innerHTML=spancontent[i]
var thisspan = eval("document.all.span"+(i)+".style")
thisspan.posLeft=0
thisspan.postop=0
}
moveball()
}

if (document.layers) {
marginbottom = window.innerHeight-10
marginright = window.innerWidth-10
for (i=0;i<=numberofletters;i++) {
var thisspan=eval("document.span"+i+".document")
thisspan.write(spancontent[i])
thisspan.close()
var thisspan=eval("document.span"+i)
thisspan.left=0
thisspan.top=0
}
moveball()
}
}
function randommaker(range) {
rand=Math.floor(range*Math.random())
return rand
}
function moveball() {
if (document.all) {
checkposition()
makesnake()
document.all.span0.style.posTop+=stepy
timer=setTimeout("moveball()",tempo)
}
if (document.layers) {
checkposition()
makesnake()
document.span0.top+=stepy
timer=setTimeout("moveball()",tempo)
}
}
function makesnake() {
for (i=numberofletters; i>=1; i--) {
xpos[i]=xpos[i-1]
ypos[i]=ypos[i-1]
}
if (document.all) {
xpos[0]=document.all.span0.style.posLeft+stepx
ypos[0]=document.all.span0.style.posTop+stepy
for (i=0;i<=numberofletters;i++) {
var thisspan=eval("document.all.span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
if (document.layers) {
xpos[0]=document.span0.left+stepx
ypos[0]=document.span0.top+stepy
for (i=0;i<=numberofletters;i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
}
function checkposition() {
if (document.all) {
if (document.all.span0.style.posLeft>marginright) {
stepx=(stepx+randommaker(2))*-1
document.all.span0.style.posLeft-=1
}
if (document.all.span0.style.posLeft<marginleft) {
stepx=(stepx+randommaker(2))*-1
document.all.span0.style.posLeft+=1
}
if (document.all.span0.style.posTop>marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.all.span0.style.posTop-=1
}
if (document.all.span0.style.posTop<margintop) {
stepy=(stepy+randommaker(2))*-1
document.all.span0.style.posTop+=1
}
}
if (document.layers) {
if (document.span0.left>=marginright) {
stepx=(stepx+randommaker(2))*-1
document.span0.left-=10
}
if (document.span0.left<=marginleft) {
stepx=(stepx+randommaker(2))*-1
document.span0.left+=10
}
if (document.span0.top>=marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.span0.top-=10
}
if (document.span0.top<=margintop) {
stepy=(stepy+randommaker(2))*-1
document.span0.top+=10
}
}
}
// - fin du Script - -->
</script>

  2 - Copiez et collez dans le Tag du <body> déjà existant les données en gras :

Remplacez le tag du body par celui-ci :

<body id="thisbody" bgcolor="#FFFFFF" onLoad="setValues()" style="width:100%;overflow-x:hidden;overflow-y:hidden">

 

  3 - Copiez et collez entre les balises <body> et </body> :

<script>
<!-- Début du Script
for (i=0;i<=numberofletters;i++) {
    document.write("<span id='span"+i+"' style='position:absolute'></span>")
    document.close()
}
// - Fin du Script - -->
</script>
<DIV id="deletethisblock" style="position:absolute;top:50px;left:50px;">
</DIV>

 Téléchargez ici le script ( 1,54 Ko )

 

 © Copyright GendNet 2000 Tout droit de reproduction strictement réservé aux membres de l'association ®