Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Falling Snow Background image
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 3

NiteOwl
Junior Member

Canada
403 Posts

Posted - 24 December 2005 :  01:31:39  Show Profile  Visit NiteOwl's Homepage  Reply with Quote
I found the following script on the net to add falling snowflakes to my forum. Can I do this with SNITZ and if so what file do I need to edit?

The following website shows this script:
http://javascript.internet.com/bgeffects/snow.html

<font color="navy"><font size="1"><SCRIPT LANGUAGE="JavaScript1.2">
<!-- Original: Altan (snow@altan.hr) -->
<!-- Web Site: http://www.altan.hr/snow -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var no = 25; // snow number
var speed = 10; // smaller number moves the snow faster
var snowflake = "http://www.your-web-site-address-here.com/snow.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;
}
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; // set coordinate variables
xp[i] = Math.random()*(doc_width-50); // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); // set step variables
if (ns4up) { // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" 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: 15px; LEFT: 15px;\"><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: 15px; LEFT: 15px;\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></div>");
}
}
}
function snowNS() { // Netscape main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + 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() { // IE main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + 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</font id="size1"></font id="navy">>

<font size="1"><font color="black">< Moved to [i]MOD Add-On Forum (W/O Code)</i> by Shaggy /></font id="black"></font id="size1">

-=NiteOwl=-

Edited by - Shaggy on 30 December 2005 11:10:30

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 24 December 2005 :  03:52:42  Show Profile  Reply with Quote
Would you not need to add the code to the inc_header.asp file and just after the second
<body>
tag add a
%>(JavaScript Code)<%
and it should work as long as you have their image (or one of your own) in the folder the JS points to.

I hope that helps.<

Cheers,

David Greening
Go to Top of Page

Sonic
New Member

Germany
82 Posts

Posted - 24 December 2005 :  04:37:58  Show Profile  Visit Sonic's Homepage  Reply with Quote
search in --> inc_header.asp
this line (new install on line 277)


Response.Write "</head>" & vbNewLine & _
"<body" & strTmpPageBGImageURL & " bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine & _



edit after that it to:


Response.Write "</head>" & vbNewLine & _
"<body" & strTmpPageBGImageURL & " bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine

if DatePart("ww", Date()) > 47 or DatePart("ww", Date()) < 10 then
Response.Write "<script language=""JavaScript1.2"" src=""snow.js"" type=""text/javascript""></SCRIPT>" & vbNewLine
end If

Response.Write "<a name=""top""></a>" & vbNewLine & _


save the script shown on your first post as --> snow.js
the green part in the code: let automaticly display the "snow" on a certain time of the year. in this sample at the 48 week of the year till the 11 week of the new year. rest of time no snow is showing.

eg left in the menu of my page:



don't forget to save the javascript and save some "snow" pics :-)
<

ich finds genial...
bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag

Edited by - Sonic on 24 December 2005 04:53:10
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 24 December 2005 :  12:53:02  Show Profile  Visit NiteOwl's Homepage  Reply with Quote
Thanks!! this is sounding better all the time:

OK, I have saved the original code to snow.js
I have a snowflake image in my images folder called snow.gif
I have edited the original script to point to the snow graphic.
I have added the new piece of code directly after the line you indicated.

However no snow is falling. :)

BTW - I ahve two instances of the code you mentioned on line 94 and line 344, I inserted your string on the 344 line.<

-=NiteOwl=-

Edited by - NiteOwl on 24 December 2005 12:57:55
Go to Top of Page

Sonic
New Member

Germany
82 Posts

Posted - 24 December 2005 :  13:22:13  Show Profile  Visit Sonic's Homepage  Reply with Quote
attention -->
delete in the snow.js file these lines

-- > <SCRIPT LANGUAGE="JavaScript1.2"> (first line)
and </script> (last line)

save it and it should work :-) the line 344 is ok
the path of the snowflakes must be right


--------------------------------------------------------------


if you wish to have 3 different snowflakes try this modificated code
(edit the gif path and make some images)
-->

var snowsrc="";
var snowsrc1="../img/snow/snow1.gif";
var snowsrc2="../img/snow/snow2.gif";
var snowsrc3="../img/snow/snow3.gif";
    
var no = 10;		// change number of snow 
var speed = 30; // smaller number moves the snow faster

var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;
  
if (ns4up||ns6up) {
   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) {  
    snowsrc = eval("snowsrc"+RanSpan(1,3));
    dx[i] = 0;
    xp[i] = Math.random()*(doc_width-50);
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;
    stx[i] = 0.02 + Math.random()/10;
    sty[i] = 0.7 + Math.random();
    if (ns4up) {
    document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"><\/layer>");
    }
    else if (ie4up||ns6up) {
    document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
    }
}
  
 
function snowIE_NS6() {
for (i = 0; i < no; ++ i) {
    yp[i] += sty[i];
    if (yp[i] > doc_height) {
       xp[i] = Math.random()*(doc_width-am[i]-10);
       yp[i] = -5;
       stx[i] = 0.02 + Math.random()/10;
       sty[i] = 0.7 + Math.random();
       doc_width = ns6up?window.innerWidth : document.body.clientWidth;
       doc_height = ns6up?window.innerHeight : document.body.clientHeight;
       }
    dx[i] += stx[i];
    if (ie4up){
       document.all["dot"+i].style.pixelTop = yp[i];
       document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
       }
    else if (ns6up){
       document.getElementById("dot"+i).style.top = yp[i];
       document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i]);
       }   
    }
    setTimeout("snowIE_NS6()", speed);
  }


function Random(N) { 
return Math.floor(N*(Math.random()%1)) 
}


function RanSpan(MinV, MaxV) { 
return MinV + Random(MaxV-MinV+1) 
}  

if (ie4up) {
snowIE_NS6();
}
<

ich finds genial...
bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag

Edited by - Sonic on 24 December 2005 13:35:37
Go to Top of Page

TonyB7
Junior Member

USA
267 Posts

Posted - 25 December 2005 :  10:25:44  Show Profile  Send TonyB7 an AOL message  Send TonyB7 a Yahoo! Message  Reply with Quote
Ditto here - the flakes just sit in the upper left corner; no falling.<
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 25 December 2005 :  14:51:45  Show Profile  Reply with Quote
I have no issues adding it to the forum: VN Commodore Support<

Cheers,

David Greening
Go to Top of Page

CalloftheHauntedMaster
Junior Member

289 Posts

Posted - 25 December 2005 :  15:53:34  Show Profile  Reply with Quote
While I'm here, can someone just post the actual code snowflake code that works.<

This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Go to Top of Page

Sonic
New Member

Germany
82 Posts

Posted - 25 December 2005 :  16:42:58  Show Profile  Visit Sonic's Homepage  Reply with Quote
see above i use this code<

ich finds genial...
bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 25 December 2005 :  17:45:59  Show Profile  Reply with Quote
The only thing I have done to get the demo working is changed the DatePart statement that Sonic supplied to be the following:
	Dim MyWeekday
	MyWeekday = DatePart("ww", date)
	if (MyWeekday > 47 and MyWeekday < 54) or (MyWeekday > 0 and MyWeekday < 10) then
		Response.Write "<script language=""JavaScript1.2"" src=""snow.js"" type=""text/javascript""></script>" & vbNewLine
	end If
This made it work for me with adding the original code to .js file and removing the lines as stated again by Sonic:
<SCRIPT LANGUAGE="JavaScript1.2"> (first line)
and </script> (last line)
It is running at the link I gave earlier now I have the DatePart working fine.
<

Cheers,

David Greening
Go to Top of Page

TonyB7
Junior Member

USA
267 Posts

Posted - 26 December 2005 :  09:25:04  Show Profile  Send TonyB7 an AOL message  Send TonyB7 a Yahoo! Message  Reply with Quote
Oops. They are indeed falling in MSIE. Any idea how to make them fall in Firefox 1.5?

Under Options>Content I have both Java and Javascript enabled.<

Edited by - TonyB7 on 26 December 2005 13:17:36
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 26 December 2005 :  16:46:41  Show Profile  Reply with Quote
OK, this is what I have that works also in Internet Explorer, Netscape and Firefox:

1. I first make a file called snow.js from the following: snow.js
2. Call on the file in inc_header.asp just after the second <body tag so it looks like the following:
	Response.Write	"<body bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine

	Dim MyWeekday
	MyWeekday = DatePart("ww", date)
	if (MyWeekday > 47 and MyWeekday < 54) or (MyWeekday > 0 and MyWeekday < 10) then
		Response.Write "<script language=""JavaScript1.2"" src=""snow.js"" type=""text/javascript""></script>" & vbNewLine
	end If

Response.Write	"<a name=""top""></a>" & vbNewLine & _
3. Use the following image for the snow flake:

That all works in all 3 browsers. I hope it helps.<

Cheers,

David Greening
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 26 December 2005 :  19:25:10  Show Profile  Visit NiteOwl's Homepage  Reply with Quote
Hi Dave I notice that my snowflakes only now come down in a group and never seem to create new ones, is this just something I need to live with since its a forum?
<

-=NiteOwl=-

Edited by - NiteOwl on 26 December 2005 20:03:08
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 26 December 2005 :  20:04:26  Show Profile  Reply with Quote
The code you have supplied needs to be changed like the following:
	"</head>" & vbNewLine & _
	vbNewLine & _
	"<body" & strTmpPageBGImageURL & " bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine

	Dim MyWeekday
	MyWeekday = DatePart("ww", date)
	if (MyWeekday > 47 and MyWeekday < 54) or (MyWeekday > 0 and MyWeekday < 10) then
		Response.Write "<script language=""JavaScript1.2"" src=""snow.js"" type=""text/javascript""></script>" & vbNewLine
	end If

Response.Write	"<a name=""top""></a>" & vbNewLine & _
		vbNewLine & _
That should work for you.
quote:
Originally posted by NiteOwl

Hi Dave My inc_header file does not ahve any Responce.Write lines after the second <Body

This is my file:

"</head>" & vbNewLine & _
vbNewLine & _
"<body" & strTmpPageBGImageURL & " bgColor=""" & strPageBGColor & """ text=""" & strDefaultFontColor & """ link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strVisitedLinkColor & """>" & vbNewLine & _
"<a name=""top""></a>" & vbNewLine & _
vbNewLine & _

<

Cheers,

David Greening
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 26 December 2005 :  20:30:38  Show Profile  Visit NiteOwl's Homepage  Reply with Quote
excellent, yes that did work! Thanks Dave<

-=NiteOwl=-
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 26 December 2005 :  21:10:22  Show Profile  Reply with Quote
Glad I could help and you got it going at: http://www.bcfmwu-forum.com/default.asp<

Cheers,

David Greening
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07