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"> 

php ファイルの代わりにプレーンな html ファイルを使用して、javascript に URL からパラメーターを読み取らせることができます。

于 2012-12-17T20:55:12.097 に答える