我在做一個互動世界地圖GIF,使用JavaScript和HTML5,這是我到目前爲止的代碼:互動GIF鏈接到視頻
<!DOCTYPE html>
<html>
<head>
<title>World Map</title>
<body>
<p>Click on a clickable area of the map for more info.</p>
<img src ="worldmap.gif" width="576" height="307" alt="World Map" usemap="#worldmap">
<map name="worldmap">
<area shape="rect" coords="265,49,279,64" href="
,但現在我卡住了,首先,我想知道如何鏈接到html5視頻標籤中的視頻,單擊鏈接的座標時,以及如何在此設置javascript參數,例如交換視頻等。我有代碼可以與視頻進行交換鏈接被點擊,我有代碼來做座標,我只是不知道如何把它放在一起。
非常感謝您的幫助,但想用我所做的方法來保持它超級簡單和種類的理解(如果它的工作原理)這裏是我的超級簡單的代碼
<!DOCTYPE html>
<html>
<head>
<title>World Map</title>
<body>
<p>Click on a clickable area of the map for more info.</p>
<img src ="worldmap.gif" width="576" height="307" alt="World Map" usemap="#worldmap">
<map name="worldmap">
<area shape="rect" coords="265,49,279,64" <video src="ukanthem.mp4"></video>
</map>
</body>
</head>
</html>
地圖打開在頁面上,但可點擊區域似乎不在那裏?
更新: 所以座標仍然不起作用,沒有區域點擊 也視頻出現在我的地圖相同的頁面上,我希望他們在一個單獨的頁面上,任何幫助嗎?同樣的無法識別的視頻,它說:「視頻無法找到,可能已經從服務器上刪除。HTTP 404」 世界地圖
點擊地圖上獲取更多信息的點擊區域。
<map name="worldmap">
<area shape="rect" coords="265,49,279,64" onclick="playVideo()">
<video id="video1" class="true" autoplay controls width="420">
<source src="ukanthem.mp4" type="video/mp4">
<source src="ukanthem.mp4" type="video/ogg">
</video>
<video id="video2" class=flase" width="420" controls>
<source src="beef.mp4">
</video>
<button id="hideButton" onclick="swap();">Switch</button>
<script>
var flag=true;
function swap() {
var myVideo1=document.getElementById("Video1");
var myVideo2=document.getElementById("video2");
flag=!flag;
video1.setAttribute("class", flag);
video2.setAttribute("class", !flag);
if (flag) {
video2.pause();
video1.play();
} else {
video1.pause();
video2.play();
}
}
</script>
</map>
</body>
</head>
</html>
你需要做的是管理視頻可以在不同的狀態,可以說如果video1正在播放,並且你按了video2鏈接。視頻1應停止播放,視頻2應播放。但它的你的網站,即時通訊現在只是猜測:)通常我不是這個網站的粉絲,但如果你想它超級簡單:http://www.w3schools.com/html/html5_video.asp試試看這裏。 – Daniel