Помогите, пожалуйста, с "подстройкой" скрипта под GOOGLE Chrome, FireFox, Opera и пр.
Приветствую всех!
Обращается к Вам Сергей Коршунов. Я - инвалид детства, ДЦП. Из-за своего заболевания сидел дома без дела. В начале лета сосед попросил "администрировать" его сайт. В середине декабра хотел установит "снег" не сайт. В сети нашёл скрипт : <script language="JavaScript1.2"><!-- Begin ///////////////////////////////////////////////// //Автор Скрипта - Федор А. Нохрин aka FANTAzeRus/ ///////////////////////////////////////////////// var no = 15; // колличество снежинок var speed =25; // скорость снежинок var snowflake = "http://www.sbor.net/~fantazer/fanta/sneg.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 = 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; 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) { 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() { for (i = 0; i < no; ++ i) { 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() { for (i = 0; i < no; ++ i) { 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> Подскажите, пожалуйста, что нужно прописать в : var ns4up = (document.layers) ? 1 : 0; var ie4up = (document.all) ? 1 : 0; Чтобы скрипт "заработал" в GOOGLE Chrome, FireDox, Opera и прочих ? С уважением, Сергей. |
se4a, снежок :-?
<!DOCTYPE HTML> <html> <head> <title>Untitled</title> <style type="text/css"> body{ background-color: rgb(0, 255, 255); } </style> </head> <body> <script> ///////////////////////////////////////////////// //Автор Скрипта - Федор А. Нохрин aka FANTAzeRus/ ///////////////////////////////////////////////// var no = 15; // колличество снежинок var speed =25; // скорость снежинок var snowflake = "http://www.sbor.net/~fantazer/fanta/sneg.gif"; var ns4up = 0; var ie4up = 1 var dx, xp, yp; var am, stx, sty; var i, doc_width = 800, doc_height = 600; doc_width = document.documentElement.scrollWidth; doc_height = Math.max(document.documentElement.scrollHeight,document.documentElement.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-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(); 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 snowIE() { for (i = 0; i < no; ++ i) { 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.documentElement.scrollWidth; doc_height = Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight); } dx[i] += stx[i]; document.getElementById("dot"+i).style.top = yp[i]+"px"; document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i])+"px"; } setTimeout("snowIE()", speed); } snowIE(); </script> </body> </html> |
ой, ещё один :)
<style> body { background: url(http://img-kiev.fotki.yandex.ru/get/6004/sockolovanatascha.5c/0_5a2f4_589aadc0_XL.gif) no-repeat center center fixed; background-size: cover; } pre { color: yellow; text-align: center; } </style> <body> <pre> Jingle Bells Dashing through the snow In a one-horse open sleigh O’er the fields we go Laughing all the way Bells on bobtail ring Making spirits bright What fun it is to laugh and sing A sleighing song tonight! Chorus: Jingle bells, jingle bells, Jingle all the way. Oh! what fun it is to ride In a one-horse open sleigh. Jingle bells, jingle bells, Jingle all the way; Oh! what fun it is to ride In a one-horse open sleigh. A day or two ago I thought I’d take a ride And soon, Miss Fanny Bright Was seated by my side, The horse was lean and lank Misfortune seemed his lot He got into a drifted bank And then we got upset. Chorus A day or two ago, The story I must tell I went out on the snow, And on my back I fell; A gent was riding by In a one-horse open sleigh, He laughed as there I sprawling lie, But quickly drove away. Chorus Now the ground is white Go it while you’re young, Take the girls tonight and sing this sleighing song; Just get a bobtailed bay Two forty as his speed Hitch him to an open sleigh And crack! you’ll take the lead. Chorus </pre> |
bes,
:victory: |
Благодарю всех за посильную помощь!
Особая благодарность - рони! Всех с Новым 2015-ым и всех благ! |
Часовой пояс GMT +3, время: 16:52. |