Javascript DOM HTML Embed width Property get

Introduction

Return the width of an embedded file:

var x = document.getElementById("myEmbed").width;

Click the button to return the width of the animation.

View in separate window

<!DOCTYPE html>
<html>
<body>

<embed id="myEmbed" src="video.mp4" width="200" height="200" style="border:1px solid">
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from   ww  w.  ja v  a  2  s.  c o m
  var x = document.getElementById("myEmbed").width;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related