Thuộc tính height của đối tượng Video trong HTML DOM trả về hoặc thiết lập một số tương ứng với chiều cao (tính bằng pixel) của phương tiện.
Cú pháp
Trả về height dưới dạng số (px):
mediaObject.height
Thiết lập height thành một số (px):
mediaObject.height = number
Ví dụ
Ví dụ minh họa thuộc tính Video height:
<!DOCTYPE html> <html> <head> <title>HTML DOM Video height</title> <style> * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-Video-height</legend> <video id="demo" width="320" height="50" controls><source src="https://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br> <input type="button" onclick="getTrackDetails()" value="Video không hiển thị"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); function getTrackDetails() { demo.height += 50; divDisplay.textContent = 'Chiều cao video: '+demo.height; } </script> </body> </html>
Kết quả
Trước khi nhấn nút „Video không hiển thị“:

Nhấn nút „Video không hiển thị“ 3 lần:
