Tài liệu Một số code hay cho Web và blog doc

6 508 1
Tài liệu Một số code hay cho Web và blog doc

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

Thông tin tài liệu

Sau đây là một vài mã hay cho Blog Web của bạn thêm sinh động hơn . Nguồn:Sưu Tầm Nhúng bảng dự báo thời tiết vào Blog hay website Đoạn mã HTML sau cho phép nhúng vào dự báo thời tiết của 5 thành phố lớn (Hà Nội, TP Hồ Chí Minh, Huế, Cà Mau, Nha Trang) trên cả nước theo 3 tiêu chuần quốc tế: nhiệt độ, thời gian ẩm độ. <p align="center"><img border="0" width="24" size="2"><b>Thời tiết một số địa phương ở nước ta </b></font></p> <p align="center"> Nhiệt độ - Thời Gian - Độ ẩm </p> <hr color="#d49f9f" width="95%" size="1"/> <form action=" WEBBOT-SELF " method="POST"> <! webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" > <p align="center"><font size="2"><b>Hà Nội</b></font></p> <p align="center">&nbsp;<img alt="Th&#7901;i ti&#7871;t m&#7897;t s&#7889; vùng &#7903; n&#432;&#7899;c ta" width="127" src="http://banners.wunderground.com/banner/gizmotimetemp_both/language/english/gl obal/stations/48820.gif" height="41"/></p> <p align="center"><font size="2"><b>Tp Hồ Chí Minh </b></font></p> <p align="center"><img alt="Th&#7901;i ti&#7871;t Tp H&#7891; Chí Minh" width="127" src="http://banners.wunderground.com/banner/gizmotimetemp_both/language/english/gl obal/stations/48900.gif" height="41"/></p> <p align="center"><font size="2"><b>Huế</b></font></p> <p align="center"><img alt="Th&#7901;i ti&#7871;t Hu&#7871;" width="127" src="http://banners.wunderground.com/banner/gizmotimetemp_both/language/english/gl obal/stations/48852.gif" height="41"/></p> <p align="center"><font size="2"><b>Cà Mau</b></font></p> <p align="center"><img alt="Th&#7901;i ti&#7871;t Cà Mau" width="127" obal/stations/48914.gif" height="41"/></p> <p align="center"><font size="2"><b>Nha Trang</b></font></p> <p align="center"><img alt="Th&#7901;i ti&#7871;t Nha Trang" width="127" src="http://banners.wunderground.com/banner/gizmotimetemp_both/language/english/gl obal/stations/48877.gif" height="41"/></p> </form> Đếm người online trên website của bạn. Bạn có một website cá nhân viết bằng HTML muốn biết có bao nhiêu người đang online trên website của mình? Việc này thật dễ dàng với sự hỗ trợ của Fastonlineusers, Bạn chỉ việc chèn đoạn mã sau vào trang web của mình: Có <script src="http://fastonlineusers.com/online.php?d=www.yoursite.com"></script > người đang truy cập. Kết quả được thể hiện như sau: Có 1 người đang truy cập. Trong đoạn mã trên, địa chỉ www.tenwebsite.com được thay bằng địa chỉ website của bạn. Bạn có thể chèn đoạn mã trên vào bất cứ vị trí nào mà bạn muốn hiển thị số người truy cập trên trang của mình. Đoạn Script trên chỉ có tác dụng khi bạn có kết nốiInternet nó sẽ được hiển thị dưới dạng số (Nếu bạn không kết nối Internet bạn sẽ không thấy gì!) Chú ý nếu bạn sử dụng Frame bạn phải chỉ ra một cách chính xác nơi đến của URL. Cụ thể là trang mà bạn muốn đếm số người online. Tạo chữ chạy với lệnh Marquee (Nâng cao) Marquee là gì? Marquee là một mã HTML để làm cho một đối tượng có thể chuyển động. Marquee mã là một mã phổ biến vì nhiều blogger sử dụng mã này vào blog của họ. Lệnh Marquee được thực hiện bằng cách sử dụng thẻ < marquee > {đối tượng}< marquee >. Lệnh marquee hiển thị tốt nếu xem tại trình duyệt Internet Explorer, tuy nhiên các trình duyệt khác sau này có nhiều phiên bản mới đã cũng có thể hiển thị tốt như IE. Một số các thuộc tính thường dùng của lệnh marquee: - BGCOLOR="color" → tạo màu nền cho vùng hiện thị lệnh marquee (có thể dùng hình nền ). - DIRECTION="left/right/up/down" → chọn hình thức chạy chữ ( trái, phải, lên, xuống ) - BEHAVIOR="scroll/slide/alternate" → thiết lập kiểu chạy chữ . Scroll → di chuyển tuần tự. Slide → di chuyện 1 thời gian, sau đó dừng lại. Alternate → di chuyển từ trái sang phải sau đó dừng lại. - TITLE="message" → Một đọan tin nhắn nhỏ được hiển thị khi người dùng rê chuột vào. - SCROLLMOUNT="number" → điều chỉnh tốc độ chạy - SCROLLDELAY="number" → chỉnh thời gian hiển thị (tính bằng giây) - LOOP="number|-1|infinite" → to manage sum of looping. - WIDTH="number" → chỉnh độ rộng của vùng chạy chữ. Có thể dùng đơn vị pixel (px) hoặc phần trăm (%). ►Một vài ví dụ : <marquee align="center" direction="left" height="100" scrollamount="2" width="100%"> Chuyển động từ trái qua phải, độ rộng 100%, cao 100px, tốc độ chạy chữ là 2 </marquee> <marquee align="center" direction="left" height="200" scrollamount="4" width="100%" behavior="alternate"> Chạy chữ qua trái rồi quay lại qua phải (thuộc tính alternate) </marquee> <div align="left"><font face="georgia" color="White"><b><marquee bgcolor="red" width="100%" scrollamount="3" behavior="alternate"> Chạy chữ với màu nền </marquee></b></font></div> <marquee onmouseover="this.stop()" onmouseout="this.start()" scrollamount="2" direction="down" width="100%" height="200" align="center"> Di chuyển xuống dưới, dừng lại khi ta rê chuột vào, chạy tiếp khi rê chuột ra </marquee> Con trỏ hiển thị chữ Chèn code này vào thẻ < head > <style>.spanstyle { position:absolute; visibility:visible; top:-50px; font-size:10pt; font- family:Verdana; font-weight:bold; color:black;}</style><script>/*Cursor Trailor Text- By Peter Gehrig (http://www.24fun.ch/)Permission given to Dynamicdrive.com to feature script in it's archive.For full source code, installation instructions, and 1000's more DHTML scripts,visit http://dynamicdrive.com*/var x,yvar step=20var flag=0// Your snappy message. Important: the space at the end of the sentence!!!var message="DYNAMIC DRIVE! "message=message.split("")var xpos=new Array()for (i=0;i<=message.length-1;i++) { xpos[i]=-50}var ypos=new Array()for (i=0;i<=message.length-1;i++) { ypos[i]=-50}function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1}function makesnake() { if (flag==1 && document.all) { for (i=message.length-1; i>=1; i ) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<message.length-1; i++) { var thisspan = eval("span"+(i)+".style") thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] } } else if (flag==1 && document.layers) { for (i=message.length-1; i>=1; i ) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<message.length-1; i++) { var thisspan = eval("document.span"+i) thisspan.left=xpos[i] thisspan.top=ypos[i] } } var timer=setTimeout("makesnake()",30)}</script> Và thêm đoạn code này vào thẻ body <script><! Beginning of JavaScript -for (i=0;i<=message.length-1;i++) { document.write("<span id='span"+i+"' class='spanstyle'>") document.write(message[i]) document.write("</span>")}if (document.layers) { document.captureEvents(Event.MOUSEMOVE);}document.onmousemove = handlerMM;// - End of JavaScript - ></script> Bạn sữa body thành code này <body onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow- y:scroll"> Xem demo ở đây http://www.dynamicdrive.com/dynamicindex13/trailortext.htm Tạo hiệu ứng mưa trong Website Chèn code sau vào thẻ < head > <style>.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: blue }</style><script language="javascript">//Rain/Snow effect- By Craig Blanchette Craiga.topcities.com//Script featured on Dynamic Drive//Visit http://www.dynamicdrive.com for this script and moresnow = false; // false-rain; true- snowsnowsym = " * " //These are the symbols for eachrainsym = " ' " //You can put images here.howmany = 10 //How many drops/snowflakes?/**************Do not need to change anything below***********/if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}else{sym = rainsym; speed=50; drops=howmany; angle=6}movex = -speed/angle; movey = speed; count = 0;function moverain(){for(move = 0; move < drops; move++){xx[move]+=movex; yy[move]+=mv[move];hmm = Math.round(Math.random()*1);if(xx[move] < 0){xx[move] = maxx+10;}if(yy[move] > maxy){yy[move] = 10;}drop[move].left = xx[move]drop[move].top = yy[move] +document.body.scrollTop;}setTimeout('moverain()','1')}</script> Chèn tiếp đoạn code sau vào trên thẻ < /BODY > <script language="javascript">if (document.all){drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()ly = "document.all[\'"; st = "\'].style"for(make = 0; make < drops; make++){document.write('<div id="drop'+make+'" class=drop>'+sym+'</div>');drop[make] = eval(ly+'drop'+make+st);maxx = document.body.clientWidth-40maxy = document.body.clientHeight-40xx[make] = Math.random()*maxx;yy[make] = -100-Math.random()*maxy;drop[make].left = xx[make]drop[make].top = yy[make]mv[make] = (Math.random()*5)+speed/4;drop[make].fontSize = (Math.random()*10)+20;if(snow) {col = 'white'}else{col = 'blue'}drop[make].color = col;}window.onload=moverain}</script> Sau đó lưu lại thưởng thức ! Chúc bạn thành công! . đây là một vài mã hay cho Blog và Web của bạn thêm sinh động hơn . Nguồn:Sưu Tầm Nhúng bảng dự báo thời tiết vào Blog hay website Đoạn mã HTML sau cho phép. Đếm người online trên website của bạn. Bạn có một website cá nhân viết bằng HTML và muốn biết có bao nhiêu người đang online trên website của mình? Việc

Ngày đăng: 25/01/2014, 15:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan