You are here: Reference > JavaScript > client-side > HTML DOM > properties > behavior (marquee)

behavior property (marquee)

Browser support:
Sets or retrieves the movement of text across the marquee element.


You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: behavior

Possible values:

String that sets or retrieves the type of the scrolling.
One of the following values:
The text scrolls to the end and then in the opposite direction.
Default. The text scrolls to the end and starts over.
The text scrolls to the end and stops.
Default: scroll.

Example HTML code 1:

This example illustrates the use of the behavior attribute:
<marquee style="width:200px;" behavior="alternate">alternate</marquee>
<br />
<marquee style="width:200px;" behavior="scroll">scroll</marquee>
<br />
<marquee style="width:200px;" behavior="slide">slide</marquee>
Did you find this example helpful? yes no

Example HTML code 2:

This example shows how to change the value of the behavior property in JavaScript:
    <script type="text/javascript">
        function ChangeBehavior (elem) {
            var marquee = document.getElementById ("myMarquee");

            // Returns the index of the selected option
            var whichSelected = elem.selectedIndex;

            // Returns the text of the selected option
            var scrollType = elem.options[whichSelected].text;

            marquee.behavior = scrollType;
    <marquee id="myMarquee" style="width:100px;" behavior="alternate">Hi There!</marquee>

    <select onchange="ChangeBehavior (this);" size="3">
        <option selected="selected" />alternate
        <option />scroll
        <option />slide
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content