HTML DOM Marquee width Property
The HTML DOM Marquee width property is used to set or return the value of the width attribute of the <marquee> element.
Syntax:
-
It returns the marquee width property.
marqueeObject.width;
-
It sets the marquee width property.
marqueeObject.width="px/%"
Property values:
- px: It defines the width value of the marquee.
- %: It defines the width value of the marquee.
Note: This property is not supported by HTML5.
Example 1: Below HTML code returns the marquee width property.
HTML
<!DOCTYPE html> < html > < head > < title > HTML DOM Marquee width property </ title > </ head > < body style = "text-align:center;" > < h1 style = "color:green;" > w3wiki </ h1 > < h2 >DOM Marquee width Property</ h2 > < marquee id = "marqueeID" direction = "right" loop = "3" bgcolor = "green" width = "250px" height = "40px" > w3wiki:A computer Science Portal for Beginner </ marquee > < br >< br > < button onclick = "btnClick()" > Return width of marquee tag </ button > < p id = "paraID" ></ p > < script > function btnClick() { var txt = document.getElementById("marqueeID").width; document.getElementById("paraID").innerHTML = txt; } </ script > </ body > </ html > |
Output:
Example 2: Below HTML code sets the Marquee width property.
HTML
<!DOCTYPE html> < html > < head > < title > HTML DOM Marquee width property </ title > </ head > < body style = "text-align:center;" > < h1 style = "color:green;" > w3wiki </ h1 > < h2 >DOM Marquee width Property</ h2 > < marquee id = "marqueeID" direction = "right" loop = "3" bgcolor = "green" width = "250px" height = "40px" > w3wiki:A computer Science Portal for Beginner </ marquee > < br >< br > < button onclick = "btnClick()" > Change width of marquee tag </ button > < p id = "paraID" ></ p > < script > function btnClick() { var txt = document.getElementById("marqueeID").width = "100px"; document.getElementById("paraID").innerHTML = txt; } </ script > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Contact Us