Joke Collection Website - Bulletin headlines - Web page code: find a scrolling subtitle code that can pause at intervals.
Web page code: find a scrolling subtitle code that can pause at intervals.
I think everyone has seen all kinds of scrolling (the most common one is used to update the news). Generally, as long as it is not a picture, it is done by HTML itself, which provides a very good scrolling mark -marquee(JS can also achieve this effect); Of course, this does not mean that pictures can't do this.
The following are some basic parameters of the marquee:
The syntax format of this tag is as follows:
& lt check box
Aligh = left | middle | right | up | down
bgcolor=#n
Direction = Left | Right | Up | Down
Behavior = type
Height =n
hspace=n
scrollamount=n
Scrolldelay=n
Width =n
VSpace=n
Loop = n> content
The following explains the meaning of each parameter:
Alignment: used to set the position of the active subtitle. In addition to the left, middle and right positions, two positions have been added: top and bottom.
Bgcolor: used to set the background color of active subtitles. You can use English words or hexadecimal numbers.
Direction: used to set the scrolling direction of active subtitles as left, right, up and down.
Behavior: used to set the scrolling mode, mainly in three ways:
Behavior =“scroll "means scrolling from one end to the other;
Behavior =“slide ":it means to quickly slide from one end to the other without repetition;
Behavior = "alternating" means scrolling back and forth between two ends.
Height: used to set the height of the scrolling subtitles.
Width: Sets the width of the scrolling subtitles.
Hspace and vspace: used to set the width of the left and right borders and the upper and lower borders of the scrolling subtitles, respectively.
Scrollamount: used to set the scrolling distance of the active subtitle. The smaller the value, the faster the scrolling speed.
Scrolldelay: used to set the delay time between scrolls. The smaller the value, the smaller the interval.
Cycle: used to set the number of scrolling. When loop=- 1, it means scrolling until the page is updated. The default is infinite scrolling to the left, and the title height is the text height; Scroll range: the width of horizontal scrolling is the width of the current position; The height of vertical scrolling is the height of the current position.
Now I'm going to introduce a new scrolling method, which uses JS method to scroll subtitles: scroll up and pause for a second or two (just like the classic scrolling method):
Just paste the following code where you want it to appear. The above gives a general introduction to the rolling practice of this website.
The specific effect can be seen as follows: Run the code box.
& lt script & gt
var marquee content = new Array(); //Define an array to store the display content.
marquee content【0】=‘& lt; a href =“#“onclick =“reinit marquee()“& gt; Refresh the latest list
marquee content【 1】=‘& lt; a href =/update list . ASP target = _ blank & gt。 The latest update of the website is 60.
marquee content【2】=‘& lt; a href =/tech/graph/2003/875 . ASP target = _ blank & gt。 Feather effect making tutorial
marquee content【3】=‘& lt; a href =/tech/program/2003/83 1 . ASP target = _ blank & gt。 MySQL & ASP & lt/a & gt; ‘;
marquee content【4】=‘& lt; a href =/tech/web/2003/874 . ASP target = _ blank & gt。 Understand CSS3
marquee content【5】=‘& lt; a href =/tech/graph/2003/864 . ASP target = _ blank & gt。 Fireworks MX 2004 performs panel operations.
marquee content【6】=‘& lt; a href =/tech/graph/2003/872 . ASP target = _ blank & gt。 Fireworks MX 2004 contour gradient filling;
marquee content【7】=‘& lt; a href =/photo/gallery/2003/873 . ASP target = _ blank & gt。 Flowers in a bottle
marquee content【8】=‘& lt; a href =/tech/graph/2003/87 1 . ASP target = _ blank & gt。 Fireworks MX realizes tabbed effect
marquee content【9】=‘& lt; a href =/photo/gallery/2003/870 . ASP target = _ blank & gt。 Lovers: Black and White Love Air
marquee content【 10】=‘& lt; a href =/tech/graph/2003/866 . ASP target = _ blank & gt。 Making MAC-style Apple Logo
marquee content【 1 1】=‘& lt; a href =/tech/graph/2003/868 . ASP target = _ blank & gt。 Eggshell making and role synthesis of eggshell fragments
var marquee interval = new Array(); //Define some commonly used and frequently used variables.
var marqueeId = 0;
var marqueeDelay = 4000
var marquee height = 16;
//The next step is to define some functions to be used.
array . prototype . random = function(){
var a = this
Var l = a. length;
for(var I = 0; I & ltl;; i++) {
var r = math . floor(math . random()*(l-I));
a = a . slice(0,r)。 concat(a . slice(r+ 1))。 concat(a【r】);
}
Return to a;
}
Function init marquee(){
marquee content = marquee content . random();
var str =““;
for(var I = 0; I & ltmath. min(3, marquee content.length); i++)str+=(I & gt; 0? ‘:‘‘)+marquee content【I】;
document . write(& lt; div id = marquee box style =“overflow:hidden; height:‘+marquee height+‘px“onmouseover =“clear interval(marquee interval【0】)“onmouseout =“marquee interval【0】= setInterval(\‘start marquee()\‘,marquee delay)“& gt; & ltdiv & gt; ‘+str+‘& lt; /div & gt; & lt/div & gt; ‘);
marquee id+= 2;
if(marquee content . length & gt; 3)marquee interval【0】= setInterval(“start marquee()“,marquee delay);
}
Function reinit marquee(){
js _ scroll _ content . src =‘scroll _ content 2 . js‘;
marquee content = marquee content . random();
var str =““;
for(var I = 0; I & ltmath. min(3, marquee content.length); i++)str+=(I & gt; 0? ‘:‘‘)+marquee content【I】;
marquee box . child nodes【(marquee box . child nodes . length = = 1? 0: 1)].innerHTML = str
marqueeId = 2;
}
Function start marquee(){
var str =““;
for(var I = 0; (I<3)&; & amp(marquee id+I & lt; marquee content . length); i++) {
str+=(I & gt; 0? ‘‘:‘‘)+marquee content【marquee id+I】;
}
marquee id+= 3;
if(marqueeId & gt; marquee content . length)marquee id = 0;
if(marquee box . child nodes . length = = 1 ){
var nextLine = document . createelement(‘DIV‘);
nextLine.innerHTML = str
marquee box . appendchild(next line);
}
Otherwise {
marquee box . child nodes【0】。 innerHTML = str
marquee box . appendchild(marquee box . child nodes【0】);
marquee box . scroll top = 0;
}
clear interval(marquee interval【 1】);
marquee interval【 1】= setInterval(“scroll marquee()“,20);
}
Function scroll marquee(){
marquee box . scroll top++;
if(marquee box . scroll top % marquee height = =(marquee height- 1)){
clear interval(marquee interval【 1】);
}
}
init marquee();
& lt/script & gt;
- Previous article:Poems about the moon and the moon landing
- Next article:Excellent traffic police personal advanced deeds materials
- Related articles
- Advertising words of shops selling handmade wooden combs
- At 9 o'clock in the evening, I made out with my boyfriend in the dormitory. Why did the man in the next room knock at the door? Is it nerves?
- Military training slogan of five-star hotel
- 2022 National Malaria Day Promotional Poster-National Malaria Day Promotional Slogan
- Classic sentences about morning running
- Projects of the 16th Hubei Province Sports Games
- What is community marketing?
- Why is it said that "a gentleman is known as righteousness, and a villain is known as benefit" (4
- Chinese Curriculum Standards (2022 Edition)
- The theme activity lesson plan for middle class "I am happy, I am brave"