Mail Giáng sinh

From: vuluongbang@hcm.vnn.vn
Chào các bạn.
Mùa giáng sinh đã đến, trong số chúng ta có lẽ ai ai cũng thiết kế vài cái thiệp Giáng sinh gửi bạn bè, hoặc là vào các trang web để gửi free card. Tôi xin được giới thiệu một cách khác, đó là làm cho các bức mail của bạn khi được đọc sẽ chơi bài nhạc Giáng sinh, đồng thời tuyết sẽ rơi trên màn hình của người đọc.

Để là được việc này, các bạn hãy làm như sau:
- Mở NotePad hay một chương trình soạn thảo file text bất kỳ.
- Chép đoạn mã sau vào và lưu lại vào trong thư mục C:\Program Files\Common Files\Microsoft Shared\Stationery với tên Snow.js (có thể lưu vào thư mục khác).

var no = 10; // snow number
var speed = 10; // smaller number moves the snow faster
var snowflake = "flake-small.gif";

var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 400, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = 500;
doc_height = 500;
}
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; // set coordinate variables
xp[i] = Math.random()*(doc_width-50); // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); // set step variables
if (ns4up) { // set layers
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() { // Netscape main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
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() { // IE main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
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();
}

var promoWin;
showPromo();

function showPromo () {

}


function closePromo () {
promoWin.close();
}

function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=3;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
}

function ReadCookie(cookieName) {
var theCookie=""+document.cookie;
var ind=theCookie.indexOf(cookieName);
if (ind==-1 || cookieName=="") return "";
var ind1=theCookie.indexOf(';',ind);
if (ind1==-1) ind1=theCookie.length;
return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

- Bạn cũng chép đoạn mã dưới đây và lưu với tên file bấy kỳ, nhưng phần mở rộng là .htm (ví dụ: Snow.htm)
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<bgsound src="Jinglebe.mid" loop="-1">
</head>
<SCRIPT language=JavaScript>
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>

<SCRIPT language=JavaScript src="snow.js">
</SCRIPT>

<body bgcolor="#000000" style="color: #FFFFFF">

<p><font face="Times New Roman" size="7" color="#0000FF"><b><i>
<marquee>Merry Christmas</marquee>
</i></b></font></p>

</body>

</html>

- Bạn hãy chép file nhạc vào chung thư mục với hai file này.
- Trong đoạn mã trên, có hàng <bgsound src="Jinglebe.mid" loop="-1">
Bạn hãy đổi tên file Jinglebe.mid thành tên file của bạn, rồi lưu lại.
- Bây giờ thì khâu chuẩn bị đã xong, tiếp theo là làm cho nó luôn đi kèm theo các bức mail khi bạn gửi đi.
- Trong OE, vào menu Tools\Option\Compose. Trong mục Stationery, bạn đánh dấu chọn Mail, sau đó click vào Select ở phía bên phải, một hộp thoại chọn file sẽ mở ra, bạn chọn file htm đã lưu (trong vì dụ là Snow.htm), rồi Ok -> Apply -> Ok.

Bây giờ, mồi khi bạn tạo thư mới và gửi đi, người nhận sẽ được nghe nhạc Giáng sinh, và nhìn thấy tuyết rơi.

Chúc các bạn thành công
(Bạn có thể liên hệ với tôi để nhận các file này)


PcLeHoan 1996 - 2002
Mirror : http://www.pclehoan.com
Mirror : http://www.lehoanpc.net

Mirror : http://www.ktlehoan.com