0
<!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="ukanthem.mp4" alt="anthem" 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>

我正在创建一个交互式 gif 图像,单击某些区域后,它会将您带到播放视频的页面,然后您可以切换到另一个视频,我的视频与交互式地图显示在同一页面上。我希望它们位于单独的页面上,单击协调区域即可访问该页面

4

1 回答 1

0

我会将 href 更改为不同的页面而不是 mp4 文件,并将要播放的 mp4 添加为参数。让其他页面读取参数并显示视频。

例如:

<area shape="rect" coords="265,49,279,64" href="playVideo.php?video=ukanthem.mp4" alt="anthem" target="_blank"> 

您可以使用纯 html 文件代替 php 文件,并让 javascript 从 URL 读取参数。

于 2012-12-17T20:55:12.097 回答