»
Tiếng AnhTiếng PhápTiếng Việt

In - Khung cuộn luôn chạy theo thanh trượt - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Scrollers » Theo chiều ngang » Khung cuộn luôn chạy theo thanh trượt
URL: https://www.javascriptbank.com/floating-right-to-left-scroller-sticking-to-the-bottom-of-your-webpage.html

Khung cuộn luôn chạy theo thanh trượt © JavaScriptBank.comHiệu ứng tạo một hộp thoại nằm ở dưới-giữa trang web và luôn di chuyển theo thanh trượt, thông tin trong hộp thoại di chuyển theo chiều từ phải sang trái.

Phiên bản đầy đủ: jsB@nk » Scrollers » Theo chiều ngang » Khung cuộn luôn chạy theo thanh trượt
URL: https://www.javascriptbank.com/floating-right-to-left-scroller-sticking-to-the-bottom-of-your-webpage.html



JavaScript
<SCRIPT>// Floating Right-To-Left-Scroller sticking at the bottom of your webpage // EDIT THE VARIABLES BELOW:// messages. Add as many messages as you likevar message=new Array()message[0]="Hello Web freak! Still going strong?"message[1]="Download over 2000+ free javascripts from our scriptcenter!"message[2]="Spice up your website with our free javascripts!"// links of the messages (you need to set up link for each message)var messageurl=new Array()messageurl[0]="http://JavaScriptBank.com"messageurl[1]="http://JavaScriptBank.com"messageurl[2]="http://JavaScriptBank.com"// targets of the links  (you need to set up a target for each message)// accepted values are '_blank' or '_top' or '_parent' or '_self'// or the name of your target-window (for instance 'main')var messagetarget=new Array()messagetarget[0]="_blank"messagetarget[1]="_blank"messagetarget[2]="_blank"// color of the messages (you need to set up a color for each message)var messagecolor= new Array()messagecolor[0]="yellow"messagecolor[1]="orange"messagecolor[2]="FFFFFF"// width of scroller (pixels)var scrollerwidth=200// height of scroller (pixels)var scrollerheight=18// speed 1: lower means fastervar pause=20// speed 2: higher means fastervar step=2// font-size of messagesvar fntsize=12// font-family of messagesvar fntfamily="Arial"// font-weight: 1 means bold, 0 means normalvar fntweight=1// backgroundcolor of scrollervar backgroundcolor="000000"// borderwidth of scroller (pixels)var borderwidth=2// width of scrollerpadding (pixels)var cellpad=10// DO  NOT EDIT ANYTHING BELOW THIS LINE!!!!var scrollerleftvar scrollertopvar screenwidthvar clipleft,clipright,cliptop,clipbottomvar i_message=0var timervar textwidthvar textcontent=""var bgcontent=""if (fntweight==1) {fntweight="700"}else {fntweight="100"}function init() {getbgcontent()gettextcontent()    if (document.all) {screenwidth=document.body.clientWidthscrollertop=document.body.clientHeight+document.body.scrollTop-(scrollerheight+2*cellpad)scrollerleft=screenwidth/2-scrollerwidth/2text.innerHTML=textcontentbgscroller.innerHTML=bgcontenttextwidth=text.offsetWidthdocument.all.bgscroller.style.posTop=scrollertop-cellpad        document.all.bgscroller.style.posLeft=scrollerleft-cellpaddocument.all.text.style.posTop=scrollertop        document.all.text.style.posLeft=scrollerleft+scrollerwidthclipleft=0clipright=0cliptop=0clipbottom=scrollerheightdocument.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"        scrolltext()    }if (document.layers) {screenwidth=window.innerWidthscrollertop=pageYOffset+window.innerHeight-(scrollerheight+2*cellpad)scrollerleft=screenwidth/2-scrollerwidth/2document.text.document.write(textcontent)document.text.document.close()document.bgscroller.document.write(bgcontent)document.bgscroller.document.close()textwidth=document.text.document.widthdocument.bgscroller.top=scrollertop-cellpad        document.bgscroller.left=scrollerleft-cellpaddocument.text.top=scrollertopdocument.text.left=scrollerleft+scrollerwidthdocument.text.clip.left=0document.text.clip.right=0document.text.clip.top=0document.text.clip.bottom=scrollerheight        scrolltext()    }}function scrolltext() {    if (document.all) {if (document.all.text.style.posLeft>=scrollerleft-textwidth) {document.all.text.style.posLeft-=stepclipright+=stepif (clipright>scrollerwidth) {clipleft+=step}document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"scrollertop=document.body.clientHeight+document.body.scrollTop-(scrollerheight+2*cellpad)document.all.bgscroller.style.posTop=scrollertop-cellpaddocument.all.text.style.posTop=scrollertopvar timer=setTimeout("scrolltext()",pause)}else {changetext()}}   if (document.layers) {if (document.text.left>=scrollerleft-textwidth) {document.text.left-=stepdocument.text.clip.right+=stepif (document.text.clip.right>scrollerwidth) {document.text.clip.left+=step}scrollertop=pageYOffset+window.innerHeight-(scrollerheight+2*cellpad)document.bgscroller.top=scrollertop-cellpaddocument.text.top=scrollertopvar timer=setTimeout("scrolltext()",pause)}else {changetext()}}}function changetext() {    i_message++if (i_message>message.length-1) {i_message=0}gettextcontent()if (document.all) {text.innerHTML=textcontenttextwidth=text.offsetWidth        document.all.text.style.posLeft=scrollerleft+scrollerwidthclipleft=0clipright=0document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"        scrolltext()}if (document.layers) {   document.text.document.write(textcontent)document.text.document.close()textwidth=document.text.document.widthdocument.text.left=scrollerleft+scrollerwidthdocument.text.clip.left=0document.text.clip.right=0        scrolltext()}}function gettextcontent() {textcontent="<span style='position:relative;font-size:"+fntsize+"pt;font-family:"+fntfamily+";font-weight:"+fntweight+";overflow-x:hidden'>"textcontent+="<a href="+messageurl[i_message]+" target="+messagetarget[i_message]+">"textcontent+="<nobr><font color="+messagecolor[i_message]+">"+message[i_message]+"</font></nobr></a></span>"}function getbgcontent() {var bgwidth=scrollerwidth+2*cellpadvar bgheight=scrollerheight+2*cellpadbgcontent="<table border="+borderwidth+" width="+bgwidth+"  height="+bgheight+" cellpadding=0 cellspacing=0>"bgcontent+="<tr><td bgcolor="+backgroundcolor+"> "bgcontent+="</td></tr></table>"}window.onresize=init;window.onload=init;</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV ID="bgscroller" style="position:absolute;"></DIV><DIV ID="text" style="position:absolute;"></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->