1. Trang chủ
  2. » Giáo án - Bài giảng

code tuyết rơi

27 568 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

#head{background:transparent url(http://img200.imageshack.us/img200/8838/snowe.gif) center bottom;} #bd{background:transparent url(http://img200.imageshack.us/img200/8838/snowe.gif) center bottom;} Theo yêu cầu 1 số bạn, mình bổ xung thêm code làm tuyết rơi toàn trang chứ ko chỉ mỗi phần thân blog nữa Code: html {background:#B5E0E6 url(http://img200.imageshack.us/img200/8838/snowe.gif) repeat-x top;} Dưới đây là một số nền về tuyết các bạn chỉ việc thay 2 - Thay tuyết rơi bằng các nền động khác : Ngoài tuyết, ta có thể thay bằng các ảnh có nền trong suốt khác, như mưa, lá rơi bằng Code sau, chỉ cần thay link ảnh vào thôi : Code: #head{background:transparent url(Link anh) center bottom;}̉ #bd{background:transparent url(Link Anh) center bottom;}̉ Dưới đây là một số nền về tuyết các bạn chỉ việc thay link ảnh bên dưới Thích ảnh nào, các bạn click chuột phải vào ảnh đó rồi chọn Properties Sau đó coppy cái link trong bảng đó là đc. Nếu dùng Firefox thì Coppy link ở dòng Location Nếu dùng IE thì coppy link ở dòng Address (URL) Code TUYẾT RƠI Giống VIP24h.NET DEMO: http://vip24h.net PHP Code: <script type="text/javascript"> /* vui lòng tham gia vào trang www.vip24h.net!! ^^ :wub: */ // Set the number of snowflakes (more than 30 - 40 not recommended) var snowmax=35 // Set the colors for the snow. Add as many colors as you like var snowcolor=new Array("#AAAACC","#DDDDFF","#CCCCDD","#F3F3F3","#F0FFFF") // Thiết kế mặt chữ (font) var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS") // Thiết kế kiểu bông tuyết (ví dụ: * ) var snowletter="*" // Thiết kế tốc độ rơi của tuyết (recommended values range from 0.3 to 2) var sinkspeed=0.6 // Kích thước bông tuyết nè! var snowmaxsize=22 // Kích thước lớn nhất của tuyết nè var snowminsize=8 // Thiết kế snowing-zone // Set 1 for all-over-snowing, set 2 for left-side-snowing // Set 3 for center-snowing, set 4 for right-side-snowing var snowingzone=1 Từ Điển Tinh Vân Bạn có muốn gắn mục tra cứu từ điển ngay trên trang web của mình, đây là dịch vụ từ điển miễn phí trực tuyến rất hay của TinhVân: - Phần script: Trích: <script LANGUAGE="JavaScript" TYPE="text/javascript"> <! function Esc(inval, utf) { inval = escape(inval); if (utf == 0) { return inval; } outval = ""; while (inval.length > 0) { p = inval.indexOf("%"); copy Script phía dưới paste vào <head> <script language="JavaScript"> <! Delayed Mouse Follow var n4=(document.layers); var n6=(document.getElementById&&!document.all); var ie=(document.all); var o6=(navigator.appName.indexOf("Opera") != -1)?true:false; //Things to alter here var msg="Welcome to My Home Page Copy code phía dưới paste vào bất kỳ chỗ nào <script LANGUAGE="JavaScript"> ns = (document.layers)?1:0; Clrs = new Array('ff0000','00ff00','ffffff','ff00ff','ffa500','ffff00','00ff00','ffffff','ff00ff') yBase = 0; xBase = 0; step = 3; currStep = 0; Ypos = 0; Xpos = 0; if (ns){ for (i = 0; i < 14; i++) document.write('<LAYER NAME="n'+i+'" Tuyết Đang Rơi Ở đây tôi mạn phép dùng ánh sao vì bông tuyết tôi không có, nếu bạn có bông tuyết cho vào, tất nhiên bông tuyết phải lớn hơn sao nhiều và thay nền đen thành nền trắng thì sẽ trở nên một trận Tuyết rơi rồi đó. Các bạn hãy nhúng đoạn Java Script bên dưới vào trang web của bạn đồng thời kết hợp với 1 image. Mức độ tương thích trình duyệt rất tốt, nó có thể tương thích với cả 2 trình duyệt Internet Explorer & Netscape Navigator. Bạn hãy copy đoạn Java Script dán vào Notepad sau đó lưu lại thành file có đuôi .htm hoặc .html. Các bạn lưu ý: Khi tạo 1 image này các bạn cần tạo image này càng nhẹ nhàng chừng nào thì bông tuyết gơi càng nhẹ nhàng và uyển chuyển chừng đó, image này phải đạt mức độ trong suốt, kích thước bức ảnh càng nhỏ thì càng đỡ phải che mất chữ của bạn. Trích: <html> <head> <title>Hieu Ung JavaScript Tuyet Dang Roi - Le Hu'ng Homepage</title> </head> <body> <center> <script LANGUAGE="JavaScript1.2"> <! Begin var no = 25; // Số tuyết var speed = 10; // Số càng nhỏ tuyết di chuyển(rơi) càng nhanh var snowflake = "images/idcs.gif"; // Nơi đây chèn hình bông tuyết var ns4up = (document.layers) ? 1 : 0; // Bộ duyệt tìm nạp vào var ie4up = (document.all) ? 1 : 0; var dx, xp, yp; // tọa độ và những vị trí thay đổi var am, stx, sty; // Độ rộng và những bước thay đổi 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; // những biến đổi toạ độ tập hợp xp[i] = Math.random()*(doc_width-50); // tập hợp những thay đổi vị trí yp[i] = Math.random()*doc_height; am[i] = Math.random()*20; // tập hợp những thay đổi độ rộng stx[i] = 0.02 + Math.random()/10; // tập hợp những thay đổi bước sty[i] = 0.7 + Math.random(); //tập hợp những thay đổi bước if (ns4up) { // những lớp tập hợp 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() { // hàm Netscape hoạt cảnh chính for (i = 0; i < no; ++ i) { // vòng lặp cho mỗi điểm 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() { // hàm IE hoạt cảnh chính for (i = 0; i < no; ++ i) { // vòng lặp cho mỗi điểm 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> </body> </html> Hiệu Ứng Chuyển Trang Chèn vào dưới thẻ <head> của web Trích: <META http-equiv="Page-Enter" content="revealTrans(Duration=3.0,Transition=24)"> <META http-equiv="Site-Exit" content="revealTrans(Duration=3.0,Transition=24)"> 1 / Trái tim bay từ dưới lên demo : http://www.newcinc.com Chèn script này sau thẻ <body> Trích: <script language=javascript>Image0 = new Image();Image0.src = "http://ddhs.ca/forum/images/tim.gif";Amount = 20; Ymouse = -50;Xmouse = -50;Ypos = new Array();Xpos = new Array();Speed = new Array();rate = new Array();grow = new Array();Step = new Array();Cstep = new Array();nsSize = new Array();ns = (document.layers)?1:0;(document.layers)? window.captureEvents(Event.MOUSEMOVE):0;function Mouse(evnt) {Ymouse=(document.layers)?evnt.pageY-20:event.y- 20;Xmouse=(document.layers)?evnt.pageX:event.x;}(document.layers)?window.onMouseMove=Mouse:document.onmousemove=Mouse;for (i = 0; i < Amount; i++) {Ypos[i] = Ymouse;Xpos[i] = Xmouse;Speed[i] = Math.random()*4+1;Cstep[i] = 0;Step[i] = Math.random()*0.1+0.05;grow[i] = 8;nsSize[i] = Math.random()*15+5;rate[i] = Math.random()*0.5+0.1;}if (ns) {for (i = 0; i < Amount; i++) {document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+Image0.src+" name='N' width="+nsSize[i]+" height="+nsSize[i]+"></LAYER>"); � }}else {document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');for (i = 0; i < Amount; i++) {document.write('<img id="si" src="'+Image0.src+'" style="position:absolute;top:0px;left:0px;filter:alpha(opacity=90)">');}document.write('</div></div>');}function MouseBubbles() {var hscrll = (document.layers)?window.pageYOffset:document.body.scrollTop;var wscrll = (document.layers)? window.pageXOffset:document.body.scrollLeft;for (i = 0; i < Amount; i++){sy = Speed[i] * Math.sin(270 * Math.PI / 180);sx = Speed[i] * Math.cos(Cstep[i] * 4);Ypos[i] += sy;Xpos[i] += sx; if (Ypos[i] < -40) {Ypos[i] = Ymouse;Xpos[i] = Xmouse;Speed[i] = Math.random() * 6 + 4;grow[i] = 5;nsSize[i] = Math.random() * 15 + 5;}if (ns) {document.layers['sn'+i].left = Xpos[i] + wscrll;document.layers['sn'+i].top = Ypos[i] + hscrll;}else {si[i].style.pixelLeft = Xpos[i] + wscrll;si[i].style.pixelTop = Ypos[i] + hscrll;si[i].style.width = grow[i];si[i].style.height = grow[i]; }grow[i] += rate[i]; Cstep[i] += Step[i];if (grow[i] > 15) grow[i] = 9;}setTimeout('MouseBubbles()', 50);}MouseBubbles();</SCRIPT> 2 / Ngôi sao tưng tưng theo chuột Demo : http://ddhs.ca/forum/ http://harrishobbies.com Chèn hết đoạn này zô thẻ <body> luôn Trích: <LAYER NAME="a0" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a1" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a2" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a3" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a4" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a5" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <LAYER NAME="a6" LEFT="10" TOP="10" VISIBILITY="SHOW" BGCOLOR="#FFFF00" CLIP="0,0,3,3"> </LAYER> <DIV ID="dot0" STYLE="position: absolute; visibility: hidden; height: 9; width: 9;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star6a.gif" WIDTH="9" HEIGHT="9"> </DIV> <DIV ID="dot1" STYLE="position: absolute; height: 9; width: 9;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star6a.gif" WIDTH="9" HEIGHT="9"> </DIV> <DIV ID="dot2" STYLE="position: absolute; height: 12; width: 13;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star5a.gif" HEIGHT="13" WIDTH="12"> </DIV> <DIV ID="dot3" STYLE="position: absolute; height: 19; width: 20;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star4a.gif" HEIGHT="20" WIDTH="19"> </DIV> <DIV ID="dot4" STYLE="position: absolute; height: 26; width: 26;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star3a.gif" WIDTH="26" HEIGHT="26"> </DIV> <DIV ID="dot5" STYLE="position: absolute; height: 30; width: 31;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star2a.gif" HEIGHT="31" WIDTH="30"> </DIV> <DIV ID="dot6" STYLE="position: absolute; height: 32; width: 33;"> <IMG SRC="http://harrishobbies.com/graphics/buttons&bullets/star1a.gif" HEIGHT="33" WIDTH="32"> </DIV> <script LANGUAGE="JavaScript"> <! hide code /* Elastic Trail script (By Philip Winston @ pwinston@yahoo.com, URL:http://members.xoom.com/ebullets) Script featured on Dynamicdrive.com For this and 100's more DHTML scripts, visit http://dynamicdrive.com */ // Thanks to Troels Jakobsen <tjak@get2net.dk> // for fix which makes it work when the page is scrolled var nDots = 7; if (document.all&&window.print) document.body.style.cssText="overflow-x:hidden;overflow-y:scroll" var Xpos = 0; var Ypos = 0; // fixed time step, no relation to real time var DELTAT = .01; // size of one spring in pixels var SEGLEN = 10; // spring constant, stiffness of springs var SPRINGK = 10; // all the physics is bogus, just picked stuff to // make it look okay var MASS = 1; var GRAVITY = 50; var RESISTANCE = 10; // stopping criterea to prevent endless jittering // doesn't work when sitting on bottom since floor // doesn't push back so acceleration always as big // as gravity var STOPVEL = 0.1; var STOPACC = 0.1; var DOTSIZE = 11; // BOUNCE is percent of velocity retained when // bouncing off a wall var BOUNCE = 0.75; var isNetscape = navigator.appName=="Netscape"; // always on for now, could be played with to // let dots fall to botton, get thrown, etc. var followmouse = true; var dots = new Array(); init(); function init() { � var i = 0; � for (i = 0; i < nDots; i++) { � � � dots[i] = new dot(i); � } � � if (!isNetscape) { � � � // I only know how to read the locations of the � � � // <LI> items in IE � � � //skip this for now � � � // setInitPositions(dots) � } � � // set their positions � for (i = 0; i < nDots; i++) { � � � dots[i].obj.left = dots[i].X; � � � dots[i].obj.top = dots[i].Y; � } � � � if (isNetscape) { � � � // start right away since they are positioned � � � // at 0, 0 � � � startanimate(); � } else { � � � // let dots sit there for a few seconds � � � // since they're hiding on the real bullets � � � setTimeout("startanimate()", 2000); � } } function dot(i) { � this.X = Xpos; � this.Y = Ypos; � this.dx = 0; � this.dy = 0; � if (isNetscape) { � � � this.obj = eval("document.dot" + i); � } else { � � � this.obj = eval("dot" + i + ".style"); � } } function startanimate() { � setInterval("animate()", 20); } // This is to line up the bullets with actual LI tags on the page // Had to add -DOTSIZE to X and 2*DOTSIZE to Y for IE 5, not sure why // Still doesn't work great function setInitPositions(dots) { � // initialize dot positions to be on top � // of the bullets in the <ul> � var startloc = document.all.tags("LI"); � var i = 0; � for (i = 0; i < startloc.length && i < (nDots - 1); i++) { � dots[i+1].X = startloc[i].offsetLeft � startloc[i].offsetParent.offsetLeft - DOTSIZE; � dots[i+1].Y = startloc[i].offsetTop + � startloc[i].offsetParent.offsetTop + 2*DOTSIZE; } // put 0th dot above 1st (it is hidden) dots[0].X = dots[1].X; dots[0].Y = dots[1].Y - SEGLEN; } // just save mouse position for animate() to use function MoveHandler(e) { Xpos = e.pageX; Ypos = e.pageY; � return true; } // just save mouse position for animate() to use function MoveHandlerIE() { Xpos = window.event.x + document.body.scrollLeft; Ypos = window.event.y + document.body.scrollTop; � } if (isNetscape) { document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = MoveHandler; } else { document.onmousemove = MoveHandlerIE; } function vec(X, Y) { this.X = X; this.Y = Y; } // adds force in X and Y to spring for dot[i] on dot[j] function springForce(i, j, spring) { var dx = (dots[i].X - dots[j].X); var dy = (dots[i].Y - dots[j].Y); var len = Math.sqrt(dx*dx + dy*dy); if (len > SEGLEN) { � var springF = SPRINGK * (len - SEGLEN); � spring.X += (dx / len) * springF; � spring.Y += (dy / len) * springF; } } function animate() { // dots[0] follows the mouse, // though no dot is drawn there var start = 0; if (followmouse) { � dots[0].X = Xpos; � dots[0].Y = Ypos; � start = 1; } for (i = start; i < nDots; i++ ) { � � var spring = new vec(0, 0); � if (i > 0) { � springForce(i-1, i, spring); � } � if (i < (nDots - 1)) { � springForce(i+1, i, spring); � } � � // air resisitance/friction � var resist = new vec(-dots[i].dx * RESISTANCE, � -dots[i].dy * RESISTANCE); � � // compute new accel, including gravity � var accel = new vec((spring.X + resist.X)/ MASS, � (spring.Y + resist.Y)/ MASS + GRAVITY); � � // compute new velocity � dots[i].dx += (DELTAT * accel.X); � dots[i].dy += (DELTAT * accel.Y); � � // stop dead so it doesn't jitter when nearly still � if (Math.abs(dots[i].dx) < STOPVEL && � Math.abs(dots[i].dy) < STOPVEL && � Math.abs(accel.X) < STOPACC && � Math.abs(accel.Y) < STOPACC) { � dots[i].dx = 0; � dots[i].dy = 0; [...]... Điện máy gia dụng Đăng ký làm thành viên Ô tô - Xe máy Ăn ngon Máy công Chợ ẩm t Sinh vật Chợ đồ li Chợ việc Lịch Làm đẹp Thời t Xem thêm: code drwaing , code web , code web nhac 22-05-2009, 10:17 PM Tặng code làm web nhạc software21 Tặng code làm web nhạc MOD Code: >>> Các bài liên quan khác - Một vài code hay về drwaing Code tán gái của lập trình viên Code lập trình về âm thanh trong C Một Số Code Hay Tập hợp code cho web Full Version Trích: [ALIGN=center]{param} + Button Image : images/bbcode/glow.gif Các mục khác để nguyên & Save lại 5/ BB Code Shadow : chữ mờ ảo + Title :Chử mờ ảo + Tag : shadow + Replacement : Trích: {param} Button Image : images/bbcode/shadow.gif Các mục khác để nguyên & Save lại 6/ BB Code post nhạc media : play tất cả các đuôi nhạc + Title: Play nhạc + Tag : music... ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> Button Image : images/bbcode/flash.gif Các mục khác để nguyên & Save lại 8/ YouTube Video : post link các files trên site youtube.com + Title : Code nhạc chạy trên Youtube + Tag : youtube + Replacement : Trích: . NAME="n'+i+'" Tuyết Đang Rơi Ở đây tôi mạn phép dùng ánh sao vì bông tuyết tôi không có, nếu bạn có bông tuyết cho vào, tất nhiên bông tuyết phải lớn hơn sao nhiều và thay. nền về tuyết các bạn chỉ việc thay 2 - Thay tuyết rơi bằng các nền động khác : Ngoài tuyết, ta có thể thay bằng các ảnh có nền trong suốt khác, như mưa, lá rơi bằng Code sau,. link ở dòng Location Nếu dùng IE thì coppy link ở dòng Address (URL) Code TUYẾT RƠI Giống VIP24h.NET DEMO: http://vip24h.net PHP Code: <script type="text/javascript"> /* vui lòng

Ngày đăng: 11/07/2014, 02:00

Xem thêm: code tuyết rơi

TỪ KHÓA LIÊN QUAN

w