How to use DOM for custom control in HTML5
This article mainly introduces how HTML5 uses DOM for custom control, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
HTML5 video Although controls can be used to display controls, and control playback pause, etc., but different browsers may display different effects, so many times we need to use Dom to customize some operations and controls. Here is a small example.
Of course, the effect is not very beautiful, if you want to look good, you can set your own CSS style.
The code is as follows:
big
small
Your browser does not support frames.
The code is as follows:
var myVideo=document.getElementById("myVideo");
function playPause()
{
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function toBig()
{
myVideo.width=560;
}
function toNormal()
{
myVideo.width=420;
}
function toSmall()
{
myVideo.width=320;
}
Note that of all the attributes, only the videoWidth and videoHeight attributes are immediately available.
Other attributes are not available until the metadata for the video has been loaded.
Thank you for reading this article carefully, I hope Xiaobian shared "HTML5 how to use DOM for custom control" This article is helpful to everyone, but also hope that everyone will support more, pay attention to the industry information channel, more relevant knowledge waiting for you to learn!