Pausing up-down Scroller
Tác giả ducmanh · Nhận xétNote: Updated March 16th, 06′. Fixed padding issue so right padding is correctly applied to the scroller.
Description: As its name suggests, this is a up-down scroller that pauses between each message! The look of the scroller is completely styled using external CSS, including the dimensions. Easily create a single line scroller just by adjusting the scroller’s height appropriately!
Demo:
/*Example message arrays for the two demo scrollers*/
var pausecontent=new Array()
pausecontent[0]=’JavaScript Kit
Comprehensive JavaScript tutorials and over 400+ free scripts!’
pausecontent[1]=’Coding Forums
Web coding and development forums.’
pausecontent[2]=’CSS Drive
Categorized CSS gallery and examples.’
var pausecontent2=new Array() pausecontent2[0]=’News.com: Technology and business reports‘ pausecontent2[1]=’CNN: Headline and breaking news 24/7‘ pausecontent2[2]=’BBC News: UK and international news‘
/*********************************************** * Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/
function pausescroller(content, divId, divClass, delay){ this.content=content //message array content this.tickerid=divId //ID of ticker div to display information this.delay=delay //Delay between msg change, in miliseconds. this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is) this.hiddendivpointer=1 //index of message array for hidden div document.write('
‘) var scrollerinstance=this if (window.addEventListener) //run onload in DOM2 browsers window.addEventListener(”load”, function(){scrollerinstance.initialize()}, false) else if (window.attachEvent) //run onload in IE5.5+ window.attachEvent(”onload”, function(){scrollerinstance.initialize()}) else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec setTimeout(function(){scrollerinstance.initialize()}, 500) }
// ——————————————————————- // initialize()- Initialize scroller method. // -Get div objects, set initial positions, start up down animation // ——————————————————————-
pausescroller.prototype.initialize=function(){ this.tickerdiv=document.getElementById(this.tickerid) this.visiblediv=document.getElementById(this.tickerid+”1″) this.hiddendiv=document.getElementById(this.tickerid+”2″) this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv)) //set width of inner DIVs to outer DIV’s width minus padding (padding assumed to be top padding x 2) this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+”px” this.getinline(this.visiblediv, this.hiddendiv) this.hiddendiv.style.visibility=”visible” var scrollerinstance=this document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1} document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0} if (window.attachEvent) //Clean up loose references in IE window.attachEvent(”onunload”, function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}) setTimeout(function(){scrollerinstance.animateup()}, this.delay) }
// ——————————————————————- // animateup()- Move the two inner divs of the scroller up and in sync // ——————————————————————-
pausescroller.prototype.animateup=function(){ var scrollerinstance=this if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){ this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+”px” this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+”px” setTimeout(function(){scrollerinstance.animateup()}, 50) } else{ this.getinline(this.hiddendiv, this.visiblediv) this.swapdivs() setTimeout(function(){scrollerinstance.setmessage()}, this.delay) } }
// ——————————————————————- // swapdivs()- Swap between which is the visible and which is the hidden div // ——————————————————————-
pausescroller.prototype.swapdivs=function(){ var tempcontainer=this.visiblediv this.visiblediv=this.hiddendiv this.hiddendiv=tempcontainer }
pausescroller.prototype.getinline=function(div1, div2){ div1.style.top=this.visibledivtop+”px” div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+”px” }
// ——————————————————————- // setmessage()- Populate the hidden div with the next message before it’s visible // ——————————————————————-
pausescroller.prototype.setmessage=function(){ var scrollerinstance=this if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it) setTimeout(function(){scrollerinstance.setmessage()}, 100) else{ var i=this.hiddendivpointer var ceiling=this.content.length this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1 this.hiddendiv.innerHTML=this.content[this.hiddendivpointer] this.animateup() } }
pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any if (tickerobj.currentStyle) return tickerobj.currentStyle["paddingTop"] else if (window.getComputedStyle) //if DOM2 return window.getComputedStyle(tickerobj, “”).getPropertyValue(”padding-top”) else return 0 }
//new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)
new pausescroller(pausecontent, "pscroller1", "someclass", 3000)
document.write("
“)
new pausescroller(pausecontent2, “pscroller2″, “someclass”, 2000)
Mã hóa trang web bằng Javascript
Tác giả ducmanh · Nhận xétVừa rồi có đọc trên Xã Luận thấy bài viết mã hóa Html bằng javascript . Thấy hay và cũng sợ biết đâu lúc cần thì trên Xã Luận lại không còn nữa nên cứ post lên đây coi như thêm 1 chỗ để mọi người download nhỡ 1 source ở đâu đó bị die thì cũng có thể vào đây download được
Mã nguồn được lấy từ xaluan.com
Các công cụ SEO (Search Engine Optimization) và SEM (Search Engine Marketing) cung cấp các thông tin quan trọng và có liên quan đến hiệu suất của trang web của bạn, các từ khóa và vị trí đặt chúng, liên kết phổ biến cùng các thứ hạng hỗ trợ tìm kiếm trong những bộ máy tìm kiếm chính như Google, Yahoo và MSN.
Tối ưu website để search engine tìm thấy bạn
Tác giả ducmanh · Nhận xétMột trong những vấn đề cơ bản nhất trong công nghệ SEO (Search Engine Optimization – Tối ưu hoá website cho việc tìm kiếm) là bảo đảm sao cho các trang web (của website) có thể dễ dàng tiếp cận với các Search engine. Không chỉ có trang chủ được chỉ số hoá (index) mà tất cả các trang trong đều phải được các search engine tìm thấy.
Càng ngày càng có nhiều người trên thế giới đang tận dụng Internet để thỏa mãn hàng loạt các nhu cầu. Vì vậy, nếu bạn là một doanh nhân muốn tận hưởng hương vị thành công trong môi trường công nghệ đang phổ biến này thì Internet là sự lựa chọn tốt nhất. Xem thêm→
Công cụ tìm kiếm Google đánh chỉ mục các ảnh trên các trang web của bạn. Trang web của bạn phải có cơ hội gì để được hiện lên trong các kết quả tìm kiếm khi ai đó sử dụng chức năng tìm kiếm ảnh trên Google để tìm ảnh trên web? Nếu bạn biết cách làm tối ưu ảnh trên web của mình thì những bức ảnh của bạn sẽ có được xếp hạng cao trong các kết quả tìm kiếm. Việc sử dụng những hình ảnh được tối ưu phù hợp và có độ liên quan cao trong các trang web của bạn sẽ mang lại lưu lượng truy cập có chất lượng từ chức năng tìm kiếm ảnh trên Google. Sử dụng các kỹ thuật được mô tả dưới đây trong việc tối ưu hóa công cụ tìm kiếm ảnh của Google. Xem thêm→
37 mẹo kéo khách vào website của bạn
Tác giả ducmanh · Nhận xétCũng như hàng hóa và các phương tiện khác, muốn website của công ty bạn được nhiều người biết đến thì phải tiếp thị, quảng bá nó. Trang web của công ty không những phải chuyên nghiệp về nội dung mà còn phải “nhà nghề” về thiết kế và biết cách lôi kéo khách đến xem.
Một số thủ thuật giúp tăng khả năng tìm kiếm trên Google.
Tác giả ducmanh · Nhận xétGoogle rõ ràng là một công cụ tìm kiếm tốt nhất trên Internet hiện nay. Nhưng phần lớn người dùng không tận dụng hết những ưu điểm của nó. Phải chăng bạn mới chỉ gõ vào một hoặc hai từ khóa rồi chờ đợi những kết quả tốt nhất? Đó có thể là phương pháp tìm kiếm nhanh nhất, nhưng với hơn 3 tỷ trang web có trong chỉ mục của Google thì bạn sẽ phải nỗ lực rất lớn để tìm ra kết quả cần thiết trong số các trang tìm được.
Thủ thuật quảng bá Website
Tác giả ducmanh · Nhận xétQuảng bá website - một khái niệm vốn không lạ lùng với những người nhiều năm kinh doanh trực tuyến - nhưng lại rất mới mẻ với những ai mới bước vào thế giới @.
Trong bài này, chúng tôi mạn phép nêu lên một số khái niệm về lĩnh vực rất cũ của thế giới nhưng lại rất mới ở Việt Nam để các bạn tham khảo: Thuật ngữ Quảng bá website.
jQuery giúp việc phát triển AJAX, JavaScript dễ dàng hơn
Tác giả ducmanh · Nhận xétKhi mà nhiều nhà phát triển chấp nhận phát triển kiểu AJAX để tạo ra các ứng dụng tương tác mạnh hơn, họ sẽ tìm các công cụ giúp đơn giản hóa cho công việc của mình.
jQuery là một công cụ như thế, một số người dùng nói rằng nó giúp tạo dự án phát triển AJAX (XML và JavaScript không đồng bộ) gọn hơn nhờ việc sử dụng JavaScript dễ dàng hơn mặc dù JavaScript nổi tiếng là khó làm việc cùng – một nhóm chuyên gia phát biểu tại cộng đồng Lang.Net của Microsoft hồi đầu tháng 8, tổ chức ở Redmond, Washington.