• Kiến thức
  • Network
  • Security
  • Software
  • Thủ thuật
  • Tin học văn phòng
  • Tin tức
  • Mail ảo tạm thời miễn phí
  • Tools tra cứu thông tin
  • Công cụ đổi số thành chữ
AnonyViet
  • Tin tức
  • Network
    • Mạng cơ bản
    • Hyper-V
    • Linux
    • Windown Server 2012
  • Security
    • Basic Hacking
    • Deface
    • Kali Linux / Parrot
    • SQL Injection
  • Thủ thuật
    • Khóa Học Miễn Phí
    • Code
    • Mẹo Vặt Máy Tính
    • Facebook
    • Windows 7/8/10/11
    • Đồ Họa
    • Video
  • Software
    • Phần mềm máy tính
    • Phần mềm điện thoại
  • Tin học văn phòng
  • Kiến thức
  • MMO
    • Advertisers – Publishers
    • Affiliate Program
    • Kiếm tiền bằng điện thoại
    • Pay Per Click – PPC
No Result
View All Result
  • Tin tức
  • Network
    • Mạng cơ bản
    • Hyper-V
    • Linux
    • Windown Server 2012
  • Security
    • Basic Hacking
    • Deface
    • Kali Linux / Parrot
    • SQL Injection
  • Thủ thuật
    • Khóa Học Miễn Phí
    • Code
    • Mẹo Vặt Máy Tính
    • Facebook
    • Windows 7/8/10/11
    • Đồ Họa
    • Video
  • Software
    • Phần mềm máy tính
    • Phần mềm điện thoại
  • Tin học văn phòng
  • Kiến thức
  • MMO
    • Advertisers – Publishers
    • Affiliate Program
    • Kiếm tiền bằng điện thoại
    • Pay Per Click – PPC
No Result
View All Result
AnonyViet
No Result
View All Result

Code Tạo Pháo Hoa Cho Website Trang Trí Tết

AnonyViet by AnonyViet
27/01/2016 - Updated on 26/12/2019
in Code
A A
6

   Ngày tết gần đến rồi, ắt hẵn những bạn làm Webiste đều muốn trang trí cho ngôi nhà thứ 2 của mình thêm lộng lẫy lung linh huyền ảo. Hôm này mình sẽ hướng dẫn cho các bạn cách tạo pháo hoa để tạo không khí tết cho Webiste nhé.

📢 Tham gia kênh Telegram của AnonyViet
👉 Vào Telegram AnonyViet
Cập nhật bài mới, tools hay và thủ thuật IT nhanh nhất

Bước 1: Trước tiên bạn cần tạo 1 file tên phaohoa.js, nội dung code copy ở dưới nhé (có thể dùng notepad). Rồi up lên Hosting

Các bài viết liên quan

lovable pro 3 thang code

Cách nhận Lovable Pro 3 tháng miễn phí – Tạo Website bằng AI

29/12/2025
cdoe tuyet trang trang tri website

Chia sẻ Code tuyết rơi cho Website đón Giáng Sinh

16/12/2025
Cách Active Key Sublime Text 4 - Tải Sublime Text 4 Full Key 2

Cách Active Key Sublime Text 4 – Tải Sublime Text 4 Full Key

23/05/2025 - Updated on 25/07/2025
vibde coding là gì

Vibe Coding là gì?

14/05/2025 - Updated on 25/07/2025

Hoặc bạn có thể tải về theo link: https://anonyviet.com/resource/phaohoa/phaohoa.js

// <![CDATA[
var bits=80; // how many bits
var speed=33; // how fast - smaller is faster
var bangs=5; // how many can be launched simultaneously (note that using too many can slow the script down)
var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cf", "#f93", "#f0c"); 
//                     blue    red     green   purple  cyan    orange  pink

/****************************
*      Fireworks Effect     *
*(c)2004-14 mf2fm web-design*
*  http://www.mf2fm.com/rv  *
* DON'T EDIT BELOW THIS BOX *
****************************/
var bangheight=new Array();
var intensity=new Array();
var colour=new Array();
var Xpos=new Array();
var Ypos=new Array();
var dX=new Array();
var dY=new Array();
var stars=new Array();
var decay=new Array();
var swide=1000;
var shigh=600;
var boddie;

if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) {
  var oldonload=window.onload;
  if (typeof(oldonload)!='function') window.onload=funky;
  else window.onload=function() {
    if (oldonload) oldonload();
    funky();
  }
}

addRVLoadEvent(light_blue_touchpaper);

function light_blue_touchpaper() { if (document.getElementById) {
  var i;
  boddie=document.createElement("div");
  boddie.style.position="fixed";
  boddie.style.top="0px";
  boddie.style.left="0px";
  boddie.style.overflow="visible";
  boddie.style.zIndex = '9999';
  boddie.style.width="1px";
  boddie.style.height="1px";
  boddie.style.backgroundColor="transparent";
  document.body.appendChild(boddie);
  set_width();
  for (i=0; i<bangs; i++) {
    write_fire(i);
    launch(i);
    setInterval('stepthrough('+i+')', speed);
  }
}}

function write_fire(N) {
  var i, rlef, rdow;
  stars[N+'r']=createDiv('|', 12);
  boddie.appendChild(stars[N+'r']);
  for (i=bits*N; i<bits+bits*N; i++) {
    stars[i]=createDiv('*', 13);
    boddie.appendChild(stars[i]);
  }
}

function createDiv(char, size) {
  var div=document.createElement("div");
  div.style.font=size+"px monospace";
  div.style.position="absolute";
  div.style.zIndex = '9999';
  div.style.backgroundColor="transparent";
  div.appendChild(document.createTextNode(char));
  return (div);
}

function launch(N) {
  colour[N]=Math.floor(Math.random()*colours.length);
  Xpos[N+"r"]=swide*0.5;
  Ypos[N+"r"]=shigh-5;
  bangheight[N]=Math.round((0.5+Math.random())*shigh*0.4);
  dX[N+"r"]=(Math.random()-0.5)*swide/bangheight[N];
  if (dX[N+"r"]>1.25) stars[N+"r"].firstChild.nodeValue="/";
  else if (dX[N+"r"]<-1.25) stars[N+"r"].firstChild.nodeValue="\\";
  else stars[N+"r"].firstChild.nodeValue="|";
  stars[N+"r"].style.color=colours[colour[N]];
}

function bang(N) {
  var i, Z, A=0;
  for (i=bits*N; i<bits+bits*N; i++) { 
    Z=stars[i].style;
    Z.left=Xpos[i]+"px";
    Z.top=Ypos[i]+"px";
    if (decay[i]) decay[i]--;
    else A++;
    if (decay[i]==15) Z.fontSize="7px";
    else if (decay[i]==7) Z.fontSize="2px";
    else if (decay[i]==1) Z.visibility="hidden";
	if (decay[i]>1 && Math.random()<.1) {
	   Z.visibility="hidden";
	   setTimeout('stars['+i+'].style.visibility="visible"', speed-1);
	}
    Xpos[i]+=dX[i];
    Ypos[i]+=(dY[i]+=1.25/intensity[N]);

  }
  if (A!=bits) setTimeout("bang("+N+")", speed);
}

function stepthrough(N) { 
  var i, M, Z;
  var oldx=Xpos[N+"r"];
  var oldy=Ypos[N+"r"];
  Xpos[N+"r"]+=dX[N+"r"];
  Ypos[N+"r"]-=4;
  if (Ypos[N+"r"]<bangheight[N]) {
    M=Math.floor(Math.random()*3*colours.length);
    intensity[N]=5+Math.random()*4;
    for (i=N*bits; i<bits+bits*N; i++) {
      Xpos[i]=Xpos[N+"r"];
      Ypos[i]=Ypos[N+"r"];
      dY[i]=(Math.random()-0.5)*intensity[N];
      dX[i]=(Math.random()-0.5)*(intensity[N]-Math.abs(dY[i]))*1.25;
      decay[i]=16+Math.floor(Math.random()*16);
      Z=stars[i];
      if (M<colours.length) Z.style.color=colours[i%2?colour[N]:M];
      else if (M<2*colours.length) Z.style.color=colours[colour[N]];
      else Z.style.color=colours[i%colours.length];
      Z.style.fontSize="13px";
      Z.style.visibility="visible";
    }
    bang(N);
    launch(N);
  }
  stars[N+"r"].style.left=oldx+"px";
  stars[N+"r"].style.top=oldy+"px";
} 

window.onresize=set_width;
function set_width() {
  var sw_min=999999;
  var sh_min=999999;
  if (document.documentElement && document.documentElement.clientWidth) {
    if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
    if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  }
  if (typeof(self.innerWidth)!="undefined" && self.innerWidth) {
    if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
    if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  }
  if (document.body.clientWidth) {
    if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
    if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  }
  if (sw_min==999999 || sh_min==999999) {
    sw_min=800;
    sh_min=600;
  }
  swide=sw_min;
  shigh=sh_min;
}
// ]]>

 

Bước 2: Chèn đoạn code dưới đây vào dưới thẻ <body> của trang Web

Lưu ý: src="https://websitecuaban.com/phaohoa.js"đây là đường dẫn của file phaohoa.js mà bạn up lên Website, nhớ thay đường dẫn cho đúng nhé.

<script src="https://websitecuaban.com/phaohoa.js"></script>
<script type="text/javascript">
var bgBegin = 22;
var bgEnd = 31;
var bgTetId = 31;
var bgTetUrl = '/banner/';
document.body.style.backgroundImage = 'url(' + bgTetUrl + bgTetId + '.jpg)';
document.body.style.backgroundAttachment = 'fixed';
document.body.style.backgroundSize = 'cover';
setInterval(function(){
	if (bgTetId == bgEnd) bgTetId = bgBegin;
	document.body.style.backgroundImage = 'url(' + bgTetUrl + bgTetId + '.jpg)';
	document.body.style.backgroundAttachment = 'fixed';
	document.body.style.backgroundSize = 'cover';
	bgTetId++;
}, 15000);
</script>

Bây giờ bạn có thể mở lại Website và nhấn F5 để refresh và thưởng thức nhé

Bạn có thể xem làm Website có ruồi chạy tại bài này

Tags: codejavascriptmãpháo hoa
AnonyViet

AnonyViet

20 năm kinh nghiệm trong lĩnh vực Security, các chứng chỉ:OSCP, CCNA, CCNP, CISSP. Kiến thức như một ngọn lửa, càng chia sẽ nó sẽ càng bùng cháy!

Related Posts

lovable pro 3 thang code
Mẹo Vặt Máy Tính

Cách nhận Lovable Pro 3 tháng miễn phí – Tạo Website bằng AI

29/12/2025
cdoe tuyet trang trang tri website
Code

Chia sẻ Code tuyết rơi cho Website đón Giáng Sinh

16/12/2025
Cách Active Key Sublime Text 4 - Tải Sublime Text 4 Full Key 3
Phần mềm máy tính

Cách Active Key Sublime Text 4 – Tải Sublime Text 4 Full Key

23/05/2025 - Updated on 25/07/2025
vibde coding là gì
Kiến thức

Vibe Coding là gì?

14/05/2025 - Updated on 25/07/2025
Hướng dẫn học lập trình miễn phí với Vue School 4
Khóa Học

Hướng dẫn học lập trình miễn phí với Vue School

02/03/2025 - Updated on 25/07/2025
Code pháo hoa trang trí cho Website dịp tết 5
Code

Code pháo hoa trang trí cho Website dịp tết

25/01/2025 - Updated on 25/07/2025
guest

guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

6 Comments
oldest
newest
Inline Feedbacks
View all comments
Lâm Trung Tính
Lâm Trung Tính
8 years ago

Hay lắm luôn Ad..Thanks nhé 😉

Reply
Nguyễn Lam
Nguyễn Lam
8 years ago

hay lắm ad :))

Reply
Blacknet
Blacknet
8 years ago

Hay lắm luôn Ad..Thanks nhé ?

Reply
Lâm Trung Tính
Lâm Trung Tính
8 years ago

Tết này sẽ sử dụng code của ad 🙂

Reply
NguyenHaSon-2006
NguyenHaSon-2006
8 years ago

hay lắm, thanks ad

Reply
Ryzen Threadripper
Ryzen Threadripper
6 years ago

Cảm ơn Admin rất nhiều~~~~

Reply
wpdiscuz   wpDiscuz

Liên hệ Quảng Cáo

Lien he AnonyViet

Bài viết mới

ChatGPT Plus miễn phí 1 tháng

Cách nhận ChatGPT Plus miễn phí 1 tháng (Mới nhất 2026)

by Thanh Kim
07/03/2026
0

ứng dụng Codex trên Windows

Hướng dẫn cài Codex trên Windows: AI lập trình của OpenAI đã có bản native

by Thanh Kim
07/03/2026
0

key Smart Game Booster Pro

Nhận ngay key Smart Game Booster Pro 6 tháng miễn phí

by Thanh Kim
06/03/2026
0

cách cấp lại bằng cấp 3 bị mất

Thủ tục và cách cấp lại bằng cấp 3 bị mất online mới nhất

by Thanh Kim
06/03/2026
0

Giới thiệu

AnonyViet

AnonyViet

Nơi chia sẻ những kiến thức mà bạn chưa từng được học trên ghế nhà trường!

Chúng tôi sẵn sàng đón những ý kiến đóng góp, cũng như bài viết của các bạn gửi đến AnonyViet.

Hãy cùng AnonyViet xây dựng một cộng đồng CNTT lớn mạnh nhất!

Giới thiệu

AnonyViet là Website chia sẻ miễn phí tất cả các kiến thức về công nghệ thông tin. AnonyViet cung cấp mọi giải pháp về mạng máy tính, phần mềm, đồ họa và MMO.

Liên hệ

Email: support[@]anonyviet.com

1409 Hill Street #01-01A
Old Hill Street Police Station
Singapore 179369

 

DMCA.com Protection Status

Bình luận gần đây

  • 45555 trong Sự trỗi dậy của “Người ngoài hành tinh”: Alienware Aurora AC16250 “Vũ khí” tối thượng định hình Gaming năm 2026
  • 45555 trong Cách làm mờ ảnh trên iPhone sau khi chụp cực đơn giản
  • vatuan13 trong Hướng dẫn cài OpenClaw – AI Trợ lý cá nhân trên máy tính
  • vatuan13 trong Hướng dẫn thiết lập định vị giả trên Zalo
  • AnonyViet trong Hướng Dẫn Cấu Hình OpenClaw Trên VPS Ubuntu 2.5G RAM (giá chỉ 18$/năm)
  • hùng lê trong Hướng Dẫn Cấu Hình OpenClaw Trên VPS Ubuntu 2.5G RAM (giá chỉ 18$/năm)
  • Kelvin trong Hướng dẫn thi chứng chỉ bảo mật CTIGA miễn phí 100%
  • Minh trong Hướng dẫn kết nối OpenClaw với Whatsapp
  • AnonyViet trong Hướng Dẫn Cấu Hình OpenClaw Trên VPS Ubuntu 2.5G RAM (giá chỉ 18$/năm)
  • congdk trong Hướng Dẫn Cấu Hình OpenClaw Trên VPS Ubuntu 2.5G RAM (giá chỉ 18$/năm)
  • AnonyViet trong Hướng dẫn cài OpenClaw – AI Trợ lý cá nhân trên máy tính
  • AnonyViet trong Hướng dẫn cài OpenClaw – AI Trợ lý cá nhân trên máy tính
  • Tran Minh trong Hướng dẫn cài OpenClaw – AI Trợ lý cá nhân trên máy tính
  • AnonyViet trong Chia sẻ key SwifDoo PDF Pro miễn phí bản quyền lên đến 1 năm
  • Kerya Kuznetsov trong Chia sẻ key SwifDoo PDF Pro miễn phí bản quyền lên đến 1 năm
  • AnonyViet trong Chia sẻ key SwifDoo PDF Pro miễn phí bản quyền lên đến 1 năm
  • 1234560987 trong Chia sẻ key SwifDoo PDF Pro miễn phí bản quyền lên đến 1 năm
  • Lim trong Tổng hợp các Website tạo VISA ảo (virtual card) để mua hàng Online
  • Linh trong Cách dùng bot tự động verify để đăng ký ChatGPT K12, Spotify Student,…
  • Thịnh trong Tải và kích hoạt Office 2021 Free với tool OfficeSavior
kết quả xổ số hôm nay U888 33win Ae888 kubet kubet 8kbet 99ok xin88 good88 kubet fm88 kubet thailand vip66 xoso66 https://tp88fun.com/ hello88 qq88 Xoso66 Vip66 hitclub bong99 XOSO66 new882.info Thabet fun88 nhà cái uy tín sunwin sunwin rikvip hitclub sunwin go88 12bet v9bet betvisa betvisa vin777 vin777 ee88 bet88 abc8 c54 https://keonhacai.fund/ sunwin cakhiatv socolive Xoso66 zx88 88vv fun88.supply EE88 FB88 https://da88.design/ https://fun88.supply/ F8BET80 https://q23win.com/ 32win https://lc88.jpn.com/ u888 8xbet W88 link 58win 58WIN ax88 https://bbet88b.com/ OK9 SHBET https://xx88.center/ vswin 789PCOM NHÀ CÁI MMOO TT88COM GO 99 RR88 ABC8 https://nowgoal.ws/ https://tylekeonhacai.me/ https://keonhacai.org.vc/ https://xx88.ac/ xx88.me.uk XN88 NOHU90 68WIN GO99 AF88 HM88 HZ88 https://xx88.asia/ 789f NOHU HITCLUB Sunwin 58WIN MV88 888NEW AZ888 PG99 TD88 12bet v9bet X88 NOHU90 Thabet vip66 7mcn hm88 SODO Casino xoso66 DA88 9BET https://daga.rocks https://c168.info/ LC88 Game WIN678 sv368 SH BET https://jun88sr.com/ GVUI TR88 NOHU90 TG88 Taptap 188bet taptap 188BET Link https://qq88pro.vip/ https://kjcgaming.com https://nohutm.com 6789 789Win 12bet https://tiendanutrisalud.com/ https://go8.red/ 23win clubv 7m https://urr88.com/ Mig8 mcw casino hit club game bai tg88 kèo nhà cái 5 9 win Sunwin UU88 VIN777 HUBET nổ hũ uy tín Go88 https://bancadoithuong.codes/ https://danhdeonline.blog/ Xocdia88 https://nhacaiuytin10.uk.com/ https://keonhacai88.tv/ https://keonhacai.loans/ https://gamebaidoithuong.io/ https://keonhacai.kiwi/ 789club 8kbet sodo casino F168 ok 8386 nk88 Tr88 https://jun88pl.com/ kèo nhà cái S8 xx88 V9BET hytw3339 tài xỉu Sun52 king52 x88 https://918xxy.com/ Luckywin https://sc88.info/ https://go99bet.live/ https://tt88.ae.org/ kjc https://socolive.stream/ F168 Nhà cái 789BET keo nha cai 5 SC88 https://lc88.bio/ F168 8us https://www.open8808.com/ c168 fly88 trang chủ sc88 hytw3339 ok9 https://go99.mx/ f168 79king Sunwin nhà cái MB66 Luck8 Alo789 hello88 f168 mb66 MV88 sc88 11uu vn23 8DAY ko66 789win 88CLB kèo nhà cái TẢI SUNWIN Thabet tg88 c168 CM88 nạp tiền qq88 8kbet Lode88 game bài game nổ hũ tỷ lệ nhà cái sun win gavangtv colatv truc tiep bong da trực tiếp bóng rổ thapcamtv iwin SH BET https://www.78wind.love/ SODO luck8 tr88 cm88 https://kjcgaming.com/ https://devmarks.io cwin Kkwin https://abc8.za.com V9bet 888slot Keonhacai5 ALO8.com F168 rikvip

©2026 AnonyViet - Chúng tôi mang đến cho bạn những kiến thức bổ ích về CNTT

No Result
View All Result
  • Tin tức
  • Network
    • Mạng cơ bản
    • Hyper-V
    • Linux
    • Windown Server 2012
  • Security
    • Basic Hacking
    • Deface
    • Kali Linux / Parrot
    • SQL Injection
  • Thủ thuật
    • Khóa Học Miễn Phí
    • Code
    • Mẹo Vặt Máy Tính
    • Facebook
    • Windows 7/8/10/11
    • Đồ Họa
    • Video
  • Software
    • Phần mềm máy tính
    • Phần mềm điện thoại
  • Tin học văn phòng
  • Kiến thức
  • MMO
    • Advertisers – Publishers
    • Affiliate Program
    • Kiếm tiền bằng điện thoại
    • Pay Per Click – PPC

©2026 AnonyViet - Chúng tôi mang đến cho bạn những kiến thức bổ ích về CNTT

wpDiscuz