gpt4 book ai didi

html - YouTube嵌入式视频不能在我的所有浏览器中运行:FireFox,IE和Chrome

转载 作者:行者123 更新时间:2023-12-03 05:45:49 25 4
gpt4 key购买 nike

我正在尝试将视频嵌入具有隐藏/显示div功能的网页,隐藏/显示div可以工作,但嵌入的视频不能,在Firefox中,当我单击显示包含所包含YouTube的div的文本时视频中仅显示一个黑色补丁(我认为那是因为它是我的背景色),但是如果我在Chrome中启动它,则会显示一个白框,表明找不到该网页,而IE则表示找不到该网页也一样

我直接从YouTube视频中复制了嵌入代码,然后从共享按钮中复制了自己的嵌入代码,使用的是'<iframe>'标记而不是'<object>'标记,我不确定是否与此有关。

这是我要嵌入的视频的嵌入代码:

<iframe width="640" height="360" src="//www.youtube.com/embed/1qNQHv6jdyY?rel=0" frameborder="0" allowfullscreen></iframe>

这是到目前为止我的网页(尚未完成):
<!DOCTYPE HTML>

<HTML>
<HEAD>
<TITLE>Index</TITLE>

<link rel="stylesheet" type="text/css" href="DubWin By Chris Mckee-Rogers.css">

<SCRIPT type="text/javascript">
function toggleShowHide(elementId) {
var element = document.getElementById(elementId);
if (element) {
if (element.style.display == "none")
element.style.display = "inline";
else
element.style.display = "none";
}
}
</SCRIPT>

</HEAD>
<BODY>

<div class="Container">
<img src="images/logo.png" alt="Logo">
<div class="Menu">
<a href="Index.html">Home</a> | <a href="artist-info.html">Artists Information</a> | <a href="songs-and-mixes.html">Songs And Mixes<a> | <a href="forms.html">Forms<a>
</div>

<DIV class="Con-text">
<h1 style="text-align: center;">Here you'll be able to hear a few of my personal selected mixes and tunes</h1>

<h2 onClick="toggleShowHide('12th Planet')">12th Planet</h2>
<div id="12th Planet" style="display:none">
<iframe width="640" height="360" src="//www.youtube.com/embed/1qNQHv6jdyY?" frameborder="0" allowfullscreen></iframe>
</div>
<br>
<h2 onClick="toggleShowHide('Bar 9')">Bar 9</h2>
<div id="Bar 9" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Bassnectar')">Bassnectar</h2>
<div id="Bassnectar" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Chase & Status')">Chase & Status</h2>
<div id="Chase & Status" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Digital Mystikz')">Digital Mystikz</h2>
<div id="Digital Mystikz" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('DJ Fresh')">DJ Fresh</h2>
<div id="DJ Fresh" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Doctor P')">Doctor P</h2>
<div id="Doctor P" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Flux Pavillion')">Flux Pavillion</h2>
<div id="Flux Pavillion" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Foreign Beggars')">Foreign Beggars</h2>
<div id="Foreign Beggars" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Gemini')">Gemini</h2>
<div id="Gemini" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Going Quantum')">Going Quantum</h2>
<div id="Going Quantum" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Kryptic Minds')">Kryptic Minds</h2>
<div id="Kryptic Minds" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Magnetic Man')">Magnetic Man</h2>
<div id="Magnetic Man" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('ModeStep')">ModeStep</h2>
<div id="ModeStep" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Mt Eden')">Mt Eden</h2>
<div id="Mt Eden" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Nero')">Nero</h2>
<div id="Nero" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Pendulum')">Pendulum</h2>
<div id="Pendulum" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Rusko')">Rusko</h2>
<div id="Rusko" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Skrillex')">Skrillex</h2>
<div id="Skrillex" style="display:none">

</div>
<br>
<h2 onClick="toggleShowHide('Sub Focus')">Sub Focus</h2>
<div id="Sub Focus" style="display:none">

</div>

</DIV>

</div>
<br>

</BODY>
</HTML>

感谢您所有的帮助。

最佳答案

如果您同时使用//wwwhttp://,则YouTube使用https://进行兼容-如果您通过本地网络服务器(即Windows上的WAMP)运行它,则可以正常工作,但是如果仅使用file://在浏览器中打开文件,

引用- Two forward slashes in a url/src/href attribute

关于html - YouTube嵌入式视频不能在我的所有浏览器中运行:FireFox,IE和Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17407876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com