kempkrafts
03-14-2004, 12:14 PM
Can anyone tell me how to make my "snow" fall to the bottom of my page, not just stop part way...? I got the code from "Lissa's" fun stuff, tried to change the height variable, but it never goes any farther...
Here is my test page......
My 1st Test Page.... (http://www.geocities.com/quilts_n_more1/test-page1.html)
Thank you,
Tam :help:
kiara
03-14-2004, 01:31 PM
you put it in the <body> right?
kempkrafts
03-14-2004, 04:49 PM
Yes... it is after the <body> tag.
Here is the first part of my page & the first part of the script...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Page.....</title></head>
<font size=6 face="Garamond,Comic Sans MS,BaskervilleTMed">
<body BGCOLOR="#C2F7FF" TEXT="#551A8B" LINK="#0000FF"
VLINK="#0083FF" ALINK="#EE0000" BACKGROUND="quilt7-back.gif" alt="">
<body>
<script language="JavaScript1.2" type="text/javascript">
<!-- This cool script is copyright Altan, visit his site! -->
<!-- http://www.altan.hr/snow -->
<!-- This script is provided free at Lissa Explains it All -->
<!-- http://www.lissaexplains.com -->
<!-- Begin
var no = 10; // snow number
var speed = 10; // smaller number moves the snow faster
var snowflake = "leaf7.gif";
var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
Thank you for looking....
Tam :(
bourdelson
03-14-2004, 06:36 PM
I don't know if this might have something to do with it, but you have two body tags, and the font tag is in the wrong spot. Change this:
<font size=6 face="Garamond,Comic Sans MS,BaskervilleTMed">
<body BGCOLOR="#C2F7FF" TEXT="#551A8B" LINK="#0000FF"
VLINK="#0083FF" ALINK="#EE0000" BACKGROUND="quilt7-back.gif" alt="">
<body>
To this:
<body BGCOLOR="#C2F7FF" TEXT="#551A8B" LINK="#0000FF"
VLINK="#0083FF" ALINK="#EE0000" BACKGROUND="quilt7-back.gif">
<font size=6 face="Garamond,Comic Sans MS,BaskervilleTMed">
pcsagewiz
03-14-2004, 07:02 PM
here try this code instead: <script language="JavaScript1.2">
grphcs=new Array(6)
Image0=new Image();
Image0.src=grphcs[0]="snow.gif";
Image1=new Image();
Image1.src=grphcs[1]="snow.gif"
Image2=new Image();
Image2.src=grphcs[2]="snow.gif"
Image3=new Image();
Image3.src=grphcs[3]="snow.gif"
Image4=new Image();
Image4.src=grphcs[4]="snow.gif"
Image5=new Image();
Image5.src=grphcs[5]="snow.gif"
Amount=10; //Smoothness depends on image file size, the smaller the size the more you can use!
Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Step=new Array();
Cstep=new Array();
ns=(document.layers)?1:0;
ns6=(document.getElementById&&!document.all)?1:0;
if (ns){
for (i = 0; i < Amount; i++){
var P=Math.floor(Math.random()*grphcs.length);
rndPic=grphcs[P];
document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");
}
}
else{
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < Amount; i++){
var P=Math.floor(Math.random()*grphcs.length);
rndPic=grphcs[P];
document.write('<img id="si'+i+'" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');
}
document.write('</div></div>');
}
WinHeight=(ns||ns6)?window.innerHeight:window.docu ment.body.clientHeight;
WinWidth=(ns||ns6)?window.innerWidth-70:window.document.body.clientWidth;
for (i=0; i < Amount; i++){
Ypos[i] = Math.round(Math.random()*WinHeight);
Xpos[i] = Math.round(Math.random()*WinWidth);
Speed[i]= Math.random()*5+3;
Cstep[i]=0;
Step[i]=Math.random()*0.1+0.05;
}
function fall(){
var WinHeight=(ns||ns6)?window.innerHeight:window.docu ment.body.clientHeight;
var WinWidth=(ns||ns6)?window.innerWidth-70:window.document.body.clientWidth;
var hscrll=(ns||ns6)?window.pageYOffset:document.body. scrollTop;
var wscrll=(ns||ns6)?window.pageXOffset:document.body. scrollLeft;
for (i=0; i < Amount; i++){
sy = Speed[i]*Math.sin(90*Math.PI/180);
sx = Speed[i]*Math.cos(Cstep[i]);
Ypos[i]+=sy;
Xpos[i]+=sx;
if (Ypos[i] > WinHeight){
Ypos[i]=-60;
Xpos[i]=Math.round(Math.random()*WinWidth);
Speed[i]=Math.random()*5+3;
}
if (ns){
document.layers['sn'+i].left=Xpos[i];
document.layers['sn'+i].top=Ypos[i]+hscrll;
}
else if (ns6){
document.getElementById("si"+i).style.left=Math.min(WinWidth,Xpos[i]);
document.getElementById("si"+i).style.top=Ypos[i]+hscrll;
}
else{
eval("document.all.si"+i).style.left=Xpos[i];
eval("document.all.si"+i).style.top=Ypos[i]+hscrll;
}
Cstep[i]+=Step[i];
}
setTimeout('fall()',50);
}
window.onload=fall
//-->
</script>
kempkrafts
03-14-2004, 07:41 PM
I LOVE This "snow" code!!! Thank you all for your help... I would never have gotten this far without it.
Thanks Again,
Tam :waving: