HTML5学习笔记(一):video,audio

            function toggleVideo(){
                var oVideo = document.getElementById("myVideo");
                if (oVideo) {
                    document.body.removeChild(oVideo);
                }
                else {
                    oVideo = document.createElement("video");
                    oVideo.src = "medias/1.m4v";//MP4格式
                    oVideo.controls = "controls";//鼠标可以控制
                    oVideo.autoplay = "true";//是否页面加载后就自动播放
                    oVideo.loop = "loop";//是否循环播放
                    oVideo.id = "myVideo";
                    document.body.appendChild(oVideo);
                }
            }
 

你可能感兴趣的:(html5)