目前尚不清楚您想对视频本身做什么。但是,我首先会尝试摆脱 CSS。如果您确实想撕下视频,然后将其包装在您自己的 HTML 中并将其放回原来的位置,您可以这样做:// Get reference to the video elementconst videoElement = document.getElementsByTagName('video')[0];// Clone the elementconst videoClone = videoElement.cloneNode(true);// Create your new containerconst videoContainer = document.createElement('div');// Do what you want with the new containerconst someHeading = document.createElement('h1');someHeading.innerText = 'This is a video';// Append stuff to the new containervideoContainer.append(someHeading);// Append the cloned video to the new containervideoContainer.append(videoClone);// Remove the old videovideoElement.remove();// Append your new video container with cloned videodocument.body.append(videoContainer);<video width="320" height="240" controls> <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"> Your browser does not support the video tag.</video>设置outerHTML只会覆盖 HTML。如果您想看到差异,您可以尝试 和 的设置innerHTML,outerHTML但就您而言,结果可能相同。