Help - Search - Members - Calendar
Full Version: Show Me Please!
Zymic Webmaster Forums > Zymic.com Support > Zymic Free Web Templates
tomluxi
blink.gif var no = 25; var speed = 10;
var snowflake = "25.gif";
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp; var am, stx, sty;
var i, doc_width = 100, doc_height = 50;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx = new Array(); xp = new Array();
yp = new Array(); am = new Array();
stx = new Array(); sty = new Array();
for (i = 0; i < no; ++ i) {
dx[i] = 0;
xp[i] = Math.random()*(doc_width-25);
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*10;
stx[i] = 0.01 + Math.random()/5;
sty[i] = 0.3 + Math.random();
if (ns4up) {
if (i == 0) {
document.write("<layer name="dot"+ i +"" left="5" ");
document.write("top="5" visibility="show"><img src="");
document.write(snowflake + "" border="0"></layer>");
} else {
document.write("<layer name="dot"+ i +"" left="5" ");
document.write("top="5" visibility="show"><img src="");
document.write(snowflake + "" border="0"></layer>");
}
} else if (ie4up) {
if (i == 0) {
document.write("<div id="dot"+ i +"" style="POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 7px; LEFT: 7px;"><img src="");
document.write(snowflake + "" border="0"></div>");
} else {
document.write("<div id="dot"+ i +"" style="POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 7px; LEFT: 7px;"><img src="");
document.write(snowflake + "" border="0"></div>");
}
}
}
function snowNS() {
for (i = 0; i < no; ++ i) {
yp[i] += sty[i];
if (yp[i] > doc_height-25) {
xp[i] = Math.random()*(doc_width-am[i]-15);
yp[i] = 0;
stx[i] = 0.01 + Math.random()/5;
sty[i] = 0.3 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
dx[i] += stx[i];
document.layers["dot"+i].top = yp[i];
document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", speed);
}
function snowIE() {
for (i = 0; i < no; ++ i) {
yp[i] += sty[i];
if (yp[i] > doc_height-25) {
xp[i] = Math.random()*(doc_width-am[i]-15);
yp[i] = 0;
stx[i] = 0.01 + Math.random()/5;
sty[i] = 0.3 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx[i] += stx[i];
document.all["dot"+i].style.pixelTop = yp[i];
document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowIE()", speed);
}
if (ns4up) {
snowNS();
} else if (ie4up) {
snowIE();
}
// End -->
</script>
Jacob
Are you actually able to explain what you are attempting here?
zpcs
Hi tomluxi,
Snowflakes huh! Pretty cool javascript you ran across here (biggest thing to remember here is that the graphic that produces the snowflake is hotlinked back to an external website other than your own - so you might want to consider creating your own snowflake graphic for your own website to draw upon internally).

Don't forget to leave the original author in the script as a credit to the creator (hate to think of plagerism) if the script was signed - as this one was.

You simply forgot to place the javascript in the <body> of a complete html structured webpage. You can view (or copy) a working basic format from here. Good luck and Think Snow! smile.gif

zpcs
tomluxi
QUOTE(zpcs @ Aug 18 2009, 11:11 AM) *
Hi tomluxi,
Snowflakes huh! Pretty cool javascript you ran across here (biggest thing to remember here is that the graphic that produces the snowflake is hotlinked back to an external website other than your own - so you might want to consider creating your own snowflake graphic for your own website to draw upon internally).

Don't forget to leave the original author in the script as a credit to the creator (hate to think of plagerism) if the script was signed - as this one was.

You simply forgot to place the javascript in the <body> of a complete html structured webpage. You can view (or copy) a working basic format from here. Good luck and Think Snow! smile.gif




thank so much! but it isnot run on "vndv" i don't know why? please tell clearly... wacko.gif thanks again!
zpcs
Hi tomluxi.
I've discovered two DOCUMENT TYPE Declaration(s) that this code appears likes to run under are non-declared and
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>SnowFlakes</title>
        <!-- author: Douglas (ZPCS)  -->
        <!-- Created: AUGUST 17, 2009  -->
        <!-- Modified: AUGUST 19, 2009 (ZPCS) -->
        <!-- Validated HTML 4.01 19AUG09: http://validator.w3.org/#validate_by_uri+with_options  -->
    </head>
    
    <body>
    <script type="text/javascript" src="../snowflake.js">
    </script>
        <p>
            <a href="http://validator.w3.org/check?uri=referer">
                <img src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01 Strict" height="31" width="88">
            </a>
        </p>
    </body>
</html>

The working javascript coding has been placed in a javascript file "snowflake.js" and then called from the "body"
Some created javascripts just don't play well with others unless you've take the time to re-work them. There could be any to a great numeric multitude of reasons it doesn't work outside the basic script.

Have a view ... zpcs
tomluxi
smile.gif thanks ! i wanna ask u s.th to learn more. can we be afriend? uhm....... how to contac u? smile.gif i wana make a site to show my lover how i love her..so that's ! thanks again!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.