mp4 视频无法从本地主机播放。
但 mp3 音频有效。
IE
以下用于播放视频的代码(存储为 C:\inetpub\wwwroot\video\testVideo.html)在通过 ( http://localhost/video/testVideo.html )访问时不起作用
<!DOCTYPE html>
<html>
<body>
<video width="400" controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,以下用于播放音频的代码 (C:\inetpub\wwwroot\audio\testAudio.html) 在通过 ( http://localhost/audio/testAudio.html )访问时有效
<!DOCTYPE html>
<html>
<body>
<audio width="400" controls>
<source src="audip.mp3" type="audio/mp3">
Your browser does not support HTML5 video.
</audio>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,当通过双击 html 文件启动网页时,它们都可以工作,即通过 (file:///C:/inetpub/wwwroot/audio/testAudio.html) 或 (file:///C:/inetpub /wwwroot/video/testVideo.html)
请解释我做错了什么。以及如何从本地主机播放视频。
我正在使用以下浏览器:
IE 11.0
Chrome 44.0
Firefox 40.0
Run Code Online (Sandbox Code Playgroud) 我创建了一个HTML页面来了解删除元素的工作原理.
代码:
<html>
<head>
<script>
var childDiv = null;
var parent1 = null;
var parent2 = null;
function init() {
childDiv = document.getElementById("child");
parent1 = document.getElementById("parent1");
parent2 = document.getElementById("parent2");
}
function rem() {
if (childDiv) {
childDiv.remove();
alert("child removed");
} else {
alert("child does not exist");
}
}
function remChild() {
if (childDiv){
if (parent1.children.length > 0) {
parent1.removeChild(childDiv);
alert("child unbound from parent");
} else {
alert("child exists but is not bound to parent");
}
} else {
alert("child does …Run Code Online (Sandbox Code Playgroud)