Open In App

HTML DOM Marquee direction Property

The marquee direction property in HTML DOM is used to set or return the value of the direction attribute of the <marquee> tag. 

Syntax:



It is used to return the marquee direction property.

marqueeObject.direction; 

It is used to set the marquee direction property.



marqueeObject.direction = "up|down|left|right"

Note: This property is depreciated from HTML 5.

Property values:

Return Value: It returns a string value representing the direction of a moving text.  

Example 1: Below HTML code illustrates to access a marquee direction property. 




<!DOCTYPE html>
<html>
         
    <body style="text-align:center;">   
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
         
        <h2>DOM Marquee direction Property</h2>
         
        <marquee id="marqueeID" direction="up">
            GeeksforGeeks:A computer Science Portal for Geeks
        </marquee>       
        <br><br>
         
        <button onclick="btnClick()">
            Get direction of Marquee element
        </button>
        <p id="paraID"></p>
 
 
 
 
 
        <script>
            function btnClick() {
                var txt = document.getElementById(
                    "marqueeID").direction;
 
                document.getElementById(
                    "paraID").innerHTML = txt;
            }
        </script>   
    </body>
</html>                           

Output:

Example 2: Below HTML code illustrates how to change the direction of the marquee object. 




<!DOCTYPE html>
<html>
         
    <body style="text-align:center;">
     
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
         
        <h2>DOM Marquee direction property</h2>
         
        <marquee id="marqueeID" direction="up">
            GeeksforGeeks:A computer Science Portal for Geeks
        </marquee>       
        <br><br>
            
        <button onclick="btnClick()">
            Change direction of Marquee element
        </button>
        <p id="paraID"></p>
 
 
 
 
 
        <script>
            function btnClick() {
                var txt = document.getElementById(
                    "marqueeID").direction  = "left";
 
                document.getElementById(
                    "paraID").innerHTML = txt;
            }
        </script>   
    </body>
</html>                           

Output:

Supported Browsers  are listed below: 


Article Tags :