小编mee*_*ena的帖子

在JavaScript中使用Math.max()函数时如何避免NaN?

我正在尝试在数组中获取最大值:

maxtime=Math.max.apply( Math, cnttimearr );
alert(maxtime);
Run Code Online (Sandbox Code Playgroud)

但是,我得到的NaN不是最大值.谁能告诉我我做错了什么?

javascript

9
推荐指数
1
解决办法
6241
查看次数

如何使用HTML5和javascript动态循环显示多个视频

我试图使用html5和java脚本逐个显示多个视频..但它没有来..我使用下面的代码

<html>
<head>
<title>video example</title>
</head>
<script>
video_count =1;
videoPlayer = document.getElementById("ss");
video=document.getElementById("myVideo");

function run(){
        video_count++;
        //alert(video_count);
        if (video_count == 4) video_count = 1;
        var nextVideo = "video/video"+video_count+".mp4";
        //videoPlayer.src = nextVideo;
        alert(nextVideo);
        videoPlayer.setAttribute("src", nextVideo[video_count]);
        videoPlayer.play();
   }
videoPlayer.onended(function(e) {
     if (!e) {
        e = window.event;
    } 
 run();
};
</script>
<body onload="run();">
<video id="myVideo" height="400" width="400" autoplay>   
  <source id="ss"  src="video/video1.mp4" type='video/mp4'>

</video>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

目前代码只显示第一个视频,它将停止...

javascript html5

7
推荐指数
2
解决办法
3万
查看次数

如何使用 html 标签禁用视频文件的默认下载或保存选项

我有一个视频文件列表并使用锚标记来显示它们。我想在没有下载或保存按钮的情况下播放视频。我已经禁用了右键单击选项,但仍然在某些浏览器中,单击链接会直接下载文件。谁能告诉我如何避免它?我使用了以下代码:

<!DOCTYPE html>
<html>
<head>
<script language='JavaScript' type='text/JavaScript'> 
    // http://htmlgenerator.weebly.com 
    var tenth = ''; 

    function ninth() { 
        if (document.all) { 
            (tenth); 
            alert("Right Click Disable"); 
            return false; 
        } 
    } 

    function twelfth(e) { 
        if (document.layers || (document.getElementById && !document.all)) { 
            if (e.which == 2 || e.which == 3) { 
                (tenth); 
                return false; 
            } 
        } 
    } 
    if (document.layers) { 
        document.captureEvents(Event.MOUSEDOWN); 
        document.onmousedown = twelfth; 
    } else { 
        document.onmouseup = twelfth; 
        document.oncontextmenu = ninth; 
    } 
    document.oncontextmenu = new Function('alert("Right Click Disable"); return false') 
</script> 
</head> …
Run Code Online (Sandbox Code Playgroud)

html javascript css php

-2
推荐指数
1
解决办法
1827
查看次数

标签 统计

javascript ×3

css ×1

html ×1

html5 ×1

php ×1