Jump to content

Will this code work for a MyBB form and my website?


sk8ertim

Recommended Posts

Hi all here is my site, http://www.skating-camp.com/ and here is my forum http://www.skating-camp.com/forums/ . This code is for falling snowflakes. How can Ipost this on my site and on my MyBB forum???Please help. :) :) :mellow: Thank you in advance TIm

self.snow = new Object;snow.amount = mod_snow_count;snow.flake  = ["http://www.slaed.net/forum/uploads/post-896-1166093572.gif"];// snow.rand( int maximum );snow.rand = function( x ){	return Math.round( Math.random() * x );}snow.data = {'x':[],'y':[],'spd':[],'stp':[],'cstp':[]}self.IsNS = ( document.layers ) ? true : false;if( self.IsNS ){	for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){		document.write("<layer name='sn" + snow.counter + "' left=0 top=0><img src="+snow.flake[ snow.rand( snow.flake.length-1 ) ]+"></layer>");	}}else{	for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){		document.write("<img id='si" + snow.counter + "' src='"+snow.flake[ snow.rand( snow.flake.length-1 ) ]+"' style='position:absolute;'>");	}}for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){	snow.data['y'][ snow.counter ] = snow.rand( screen.availHeight );	snow.data['x'][ snow.counter ] = snow.rand( screen.availWidth );	snow.data['spd'][ snow.counter ] = Math.random()*3+2;	snow.data['cstp'][ snow.counter ] = 0;	snow.data['stp'][ snow.counter ] = Math.random()*0.1+0.05;}debug = true;snow.fall = function(){	var hscrll = window.pageYOffset || document.documentElement.scrollTop;	var wscrll = window.pageXOffset || document.documentElement.scrollLeft;	for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){		var obj = document.getElementById( "si" + snow.counter ) || document.layers['sn' + snow.counter];		snow.data['y'][ snow.counter ] += snow.data['spd'][snow.counter] * Math.sin( 90 * Math.PI / 180 );		snow.data['x'][ snow.counter ] += snow.data['spd'][snow.counter] * Math.cos( snow.data['cstp'][ snow.counter ] );		if( snow.data['y'][ snow.counter ] + obj.offsetHeight +60 > screen.availHeight ){			snow.data['y'][ snow.counter ] = -60;			snow.data['x'][ snow.counter ] = snow.rand( screen.availWidth );			snow.data['spd'][ snow.counter ] = Math.random()*5+2;		}		if( snow.data['x'][ snow.counter ] + obj.offsetWidth +60 > screen.availWidth ){			snow.data['y'][ snow.counter ] = snow.rand( screen.availHeight );			snow.data['x'][ snow.counter ] = -60;			snow.data['spd'][ snow.counter ] = Math.random()*5+2;		}		if( self.IsNS ){			obj.left = snow.data['x'][snow.counter] + wscrll;			obj.top  = snow.data['y'][snow.counter] + hscrll;		}		else{			obj.style.left = String( snow.data['x'][snow.counter] + wscrll ) + "px";			obj.style.top  = String( snow.data['y'][snow.counter] + hscrll ) + "px";		}		snow.data['cstp'][ snow.counter ] += snow.data['stp'][ snow.counter ];	}	setTimeout( "snow.fall()", 10 );}snow.fall();

Link to comment
Share on other sites

That will work on any page, just put it in script tags somewhere in the code.

Link to comment
Share on other sites

What script is this? JavaScript?
Oh - it is JavaScript, so you can put it in your <head> tag e.g.
<head><!-- ther will be code here, DON'T get rid of it --><script type="text/javascript">//Put the falling snow code here</script></head>

And how can I post this?
If you mean "post" as in what I am doing now you can't, because most forum systems prevents people form putting JS in their posts for security reasons. You will have to edit the MyBB source and insert the code there.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...