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:
- up: It sets the direction to upward.
- down: It sets the direction downward.
- left: It sets the direction to the left. It is a default value.
- right: It sets the direction to the right.
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.
HTML
<!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.
HTML
<!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:
- Google Chrome 1.0
- Edge 12.0
- Firefox 1.0
- Internet Explorer 2.0
- Opera 7.2
- Safari 1.2