Open In App

HTML DOM Marquee loop Property

Last Updated : 15 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The Marquee loop property in HTML DOM is used to set or return the value of the loop attribute of the <marquee> element.  The loop attribute is used to specify the number of times the marquee text should loop. 

Syntax:

It returns the marquee loop property.

marqueeObject.loop; 

It sets the marquee loop property.

marqueeObject.loop ="number";

Note: This property is depreciated from HTML 5.

Property Values: It contains a numeric value that represents the number of times that the marquee should loop. The default value of the loop is INFINITE.

Example 1:  Below HTML code returns the marquee loop property. 

HTML




<!DOCTYPE html>
<html>
         
    <body style="text-align:center;">
     
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
         
        <h2>DOM Marquee loop property</h2>
         
        <marquee id="marqueeID" direction="right"
                 behavior="slide" loop="3">
            GeeksforGeeks:A Computer Science Portal for Geeks
        </marquee>       
        <br><br>
         
        <button onclick="btnClick()">
          Return loop property
        </button>
         <p id ="paraID"></p>
 
 
        <script>
            function btnClick() {
                var txt = document.getElementById("marqueeID").loop;
                document.getElementById("paraID").innerHTML = txt;
            }
        </script>   
    </body>
</html>


Output:

HTML DOM Marquee loop Property

HTML DOM Marquee loop Property

Example 2: Below HTML code sets the marquee loop property. 

HTML




<!DOCTYPE html>
<html>
         
    <body style="text-align:center;">
     
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
         
        <h2>DOM Marquee loop property</h2>
         
        <marquee id="marqueeID" direction="right"
                 behavior="slide" loop="3">
            GeeksforGeeks:A computer Science Portal for Geeks
        </marquee>       
        <br><br>
         
        <button onclick="btnClick()">
          Set loop property
        </button>
        <p id ="paraID"></p>
 
 
        <script>
            function btnClick() {
                var txt = document.getElementById(
                    "marqueeID").loop = "5";
 
                document.getElementById("paraID").innerHTML
                    = "The value of the loop attribute"
                    + " was changed to " + txt;
            }
        </script>   
    </body>
</html>


Output:

HTML DOM Marquee loop Property

HTML DOM Marquee loop Property



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads