Forum Moderators: open

Message Too Old, No Replies

Falling Snow

         

sieGe

1:46 am on Oct 29, 2008 (gmt 0)

10+ Year Member



I'm not too good with javascript, and I was wondering if you could tell me the code that would help in making the script work on Mozilla? It works in all other browsers, but there isn't anything written for firefox. If you could help me out that would be great.

Here is the code:

var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)
var browserok=ie5¦¦ns6¦¦opera

That is what makes it work in other browsers I assume, and I just need to know the one for Mozilla. If you want the whole script I can reply with that if you need.

Thank you,
Kaz

rocknbil

5:55 pm on Oct 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard sieGe! I would suggest avoiding browser-specific identification and identify just the objects in your document that will work. Instead of

var browserinfos=navigator.userAgent
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)
var browserok=ie5¦¦ns6¦¦opera

document.all only applies to IE browsers. Your match only "matches" Opera. NS is officially a defunct browser.

Try something like

var browserok=false;
if (document.getElementById) { browserok=true; }
else { alert('Your browser is not supported'); }

... 0r some other action in the else. Or eliminate the else and do nothing.

Then throughout your script, just take actions on document.getElementById.

httpwebwitch

7:20 pm on Oct 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



or go shopping around for a new script, one that works in all browsers from the getgo.

the "falling snow" effect is Jurassic. there are lots of variations out there.

daveVk

10:40 pm on Oct 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check if mozilla is reporting a script error, tools -> Error console

sieGe

1:27 am on Oct 30, 2008 (gmt 0)

10+ Year Member



Thanks for the replies guys.

I've looked at some scripts, but a lot of them use images. I want to just use the text '*' in different sizes, fonts and colours. I have found a few that are like that but still do not work when I have inserted the script and uploaded.

HOWEVER, when I look at this site as a tutorial (http://rainbow.arch.scriptmania.com/scripts/bg/snow_fall_1.html), it works in Mozilla Firefox? But when I put it on my site, it won't do anything. Any further suggestions?

[edited by: sieGe at 1:32 am (utc) on Oct. 30, 2008]

daveVk

2:45 am on Oct 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



May be clashing with other scripts you are using, try moving script below others.

sieGe

2:53 pm on Oct 30, 2008 (gmt 0)

10+ Year Member



hmm, well the only other javascript I'm using on the site I'm doing it for, is for a popup window and rollover images. But these scripts are in the <head></head> tags, and the falling snow one, is just above the </body> tag. I don't get it? Would you like the url for my site, so inspect/solve?

daveVk

10:39 pm on Oct 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



check that others scripts are not also doing browser detection and setting different values to these

var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)
var browserok=ie5¦¦ns6¦¦opera