Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use DOM for custom control in HTML5

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report