Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <select size="30" onchange="changeUrl1(this); changeUrl2(this);">
  2. <?php
  3. $files = array();
  4. $dir = opendir('./video');
  5. while(false != ($file = readdir($dir))) {
  6.         if(($file != ".") and ($file != "..") and ($file != "index.html")) {
  7.                 $files[] = $file;
  8.         }  
  9. }
  10. $nbr_capta=count($files);
  11. natsort($files);
  12.  
  13. foreach($files as $file) {
  14.     $file=addslashes($file);
  15.     $file2=stripslashes(str_replace('.mp4','',$file));
  16.    
  17. ?>
  18.     <option value="<?=$file?>"><?=$file2?></option>
  19.    
  20. <?php
  21. }
  22. ?>
  23. </select>
  24.  
  25. <script type="text/javascript">
  26.       function changeUrl1(selectObject) {
  27.         var value = selectObject.value;  
  28.         document.getElementById('video').src='video/'+value;
  29.         }
  30.       function changeUrl2(selectObject) {
  31.        var value = selectObject.value;  
  32.         document.getElementById('titre').innerHTML=value;
  33.       }
  34. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement