By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,702 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,702 IT Pros & Developers. It's quick & easy.

JavaScript not working in Safari

computerfox
100+
P: 278
Hello everyone,

I'm not sure if it's just my copy of Safari (Lion) or not, but for some reason the following doesn't work:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. $(document).ready(function(){
  4.  
  5.  
  6. var audio=document.querySelector("audio");
  7. audio.src="playlists/music/"+song[i];
  8.  
  9. audio.volume = audio.volume - .6;
  10.  
  11.  
  12. audio.load();
  13. audio.play();
  14.  
  15. $("#nowplaying").text(song[i]);
  16. $("#next").text(song[i+1]);
  17. //});
  18.  
  19.  
  20. audio.addEventListener('ended',function(){
  21.  
  22. //alert(i);
  23.  
  24. audio=document.querySelector("audio");
  25.  
  26. audio.src="playlists/music/"+song[i+1];
  27. //alert(song[i]);
  28.  
  29. audio.load();
  30. audio.play();
  31.  
  32. i++;
  33.  
  34. //alert(song.length); 
  35. //alert(i);
  36.  
  37.  
  38. $("#song").text("playlists/music/"+song[i]);
  39.  
  40. $("#nowplaying").text(song[i]);
  41. $("#next").text(song[i+1]);
  42.  
  43. if(i==song.length){
  44.  
  45. i=0;
  46.  
  47. audio.src="playlists/music/"+song[i];
  48.  
  49. $("#song").text("playlists/music/"+song[i]);
  50.  
  51. $("#nowplaying").text(song[i]);
  52. $("#next").text(song[i+1]);
  53.  
  54.  
  55. }
  56.  
  57. },false);
  58.  
  59.  
  60. });
  61. });
  62.  
  63.  
It's suppose to move the playlist to the next song. I don't get any errors, it just doesn't move i. It works in every other browser, just not Safari, which is weird because it use to before.

Any ideas?
Nov 7 '11 #1
Share this Question
Share on Google+
1 Reply


computerfox
100+
P: 278
Some updates-I tried troubleshooting what was going on and it's not even Safari. It's actually my operating system (Lion).



edit: it's actually the combination of Safari in Lion. Lion seems to have a bug with JavaScript.
Nov 7 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.