简体   繁体   中英

Pass a variable from JavaScript to jsp array

<script type="text/javascript">  
    video_count =0;
    videoPlayer = document.getElementById("ss");        
    video=document.getElementById("myVideo");

    function run() {
        video_count++;
        if (video_count == 3) video_count = 1;
        videoPlayer.setAttribute("src","<%=newdirectory+files[i]%>");     
        video.load();    
        video.play();
    }
</script>   

Is that possible to pass the video_count++ variable to jsp array file[i] in function run() ?? because all my video files are store in jsp array and I would like to use js video_count++ to load the next video in my array. Thanks

我建议使用另一种方法:将所有视频加载到页面加载(ajax和JSON)上,将它们存储在javascript数组中,然后遍历该数组。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM