SCROLLING MARQUEE'S
Scrolling marquees have been popular ever since they were
created. In this tutorial i plan to go in-depth on the Scrolling Marquee and al
of its features, as well as provide a complete cross-browser customizable
marquee with JavaScript features (this is at the end).
The basic syntax for the marquee is:
<marquee>Text</marquee>
Any text between the two tags appears on its own line,
scrolling from left to right (by default, we will learn how to change this a
little bit later on) at a slow pace. When the message completely disappears on
the left, it starts over on the right again, and so on. Incompatible browsers
simply show the text within the tags inline with surrounding text. Now lets take
a look at the attributes that are built into the
<marquee> tag.
- behavior: This attribute determines how the
message moves, either SCROLL, SLIDE, or ALTERNATE
are acceptable. The default is SCROLL. A SLIDE behavoir is
when the message comes in from the right and stops when the first letter
touches the left margin. An ALTERNATE behavior is when the message
comes in from the right, touches the left margin, and then moves back to the
right margin. It then continuous to bounce back and forth between the two
margins.
- direction: This attribute, used only with behavoir-SCROLL,
determines the direction in which the marquee text moves. The default is RIGHT,
which specifies text moving from the right side to the left. The only other
possible values are UP, DOWN, and LEFT.
- loop:Like the attribute of the same name
for AVI files and backround sounds, this attribute determines how many times
the marquee will scroll. The default is INFINITE, which can also be
represented with -1. After a marquee stops, the message remains on
the screen (it just doesn't scroll).
- scrollamount: This attribute determines the
number of pixels by which to increment the text at each step in the
scrolling process. Higher numbers mean faster scrolling, although it might
not appear to move as smoothly.
- scrolldelay: This attribute determines the
number of milliseconds to delay between each step in the scrolling process.
Large numbers result in slower and less smooth scrolling,
- bgcolor: Normally, the marquee is
transparent to the page behind it. The bgcolor attribute specifies
a color for the space behind the marquee and is represented by using a color
name or a hexadecimal number.
- height, width: These two attributes set the
size occupied by the marquee. Either value can be set in pixels or as a
percentage of the screen size. THe default size is 100%of screen width and
one text line of height.
- hspace, vpsace: These attributes determine
the amount of space (in pixels) between the edges of the marquee's space and
other elements on the page. hspace stands for horizontal space
(left and right), and vspace stands for vertical space *above and
below).
- align: This attribute sets how text and
other material adjacent to the marquee will align with the marquee's area.
The values are TOP, MIDDLE and BOTTOM. It does not affect
text within the marquee, which is always aligned to the top of the available
space.
Now that i have bored you with all this reading, i
should probably show some examples of those attributes being used. Lets start
with the most simplest example, making a marquee that scrolls left:
<marquee behavior=scroll direction="left">Your message
here</marquee>
This produces:
Remember you can change LEFT to also be UP, RIGHT, DOWN.
Now how about making the marquee alternate back and
forth?
<marquee behavior="alternate">your message
here</marquee> Producing:
Now how about adding some nice backround color to our
marquee?
<marquee bgcolor="#FF0000">your message
here</marquee>
Producing:
Don't forget to replace FF0000 with any hexadecimal color code you wish.
Now how about controlling the speed of the marquee?
<marquee scrollamount="5">your message
here</marquee>
This will produce:
Now you can customize what is inside the marquee tag in
any way you want. You can add images, JavaScript, PHP and everything else. Here
is a customized marquee I often use:
Important News Heading
News Content
Important News Heading
News Content
More News Content
Now how am I achieving these effects? Well this is a simple marquee tag with
some JavaScript added into it. Here is the code:
<center>
<marquee height="65" width="200"
onmouseover="this.stop()" onmouseout="this.start()"
direction="up" scrollamount="1"
style="Filter:Alpha(Opacity=100, FinishOpacity=0, Style=1, StartX=0,
StartY=40, FinishX=0, FinishY=0);"><font face="verdana"
color="#000000">
<center><b><script>
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new
Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<small><font
color='000000' face='Arial'><b>"+dayarray[day]+",
"+montharray[month]+" "+daym+",
"+year+"</b></font></small>")
</script>
<br>
<br>
</b>
<u>Important News Heading</u>
<br>
News Content
<br>
<br>
<u>Important News Heading</u>
<br>
News Content
<br>
<br>
More News Content
<br>
</center>
</font></marquee>
</center>