2012-12-17 57 views
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图像,点击某些区域后,它会将您带到播放视频的页面,然后您可以切换到另一个视频,我的视频显示在与交互式地图相同的页面。我希望他们在一个单独的页面上访问点击协调区域需要单独页面上的视频

回答

0

我会改变href到一个不同的页面而不是mp4文件,并添加你想播放的mp4作为参数。让另一页读取参数并显示视频。

例如:

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

你可以代替一个PHP文件使用一个普通的HTML文件,然后让JavaScript的阅读从URL参数。

相关问题