This works on all browser except IE9, getAttribute return null on IE9, any ideas
function getFlashMovieObject(movieName){
if(document.embeds[movieName])
return document.embeds[movieName];
if(window.document[movieName])
return window.document[movieName];
if(window[movieName])
return window[movieName];
if(document[movieName])
return document[movieName];
}
function ChangePlaylist(newval,mymovievarmp3){
var mp3Player = getFlashMovieObject(mymovievarmp3);
var newstring = mp3Player.getAttribute('data');
var broken = new Array();
broken = newstring.split('?');
mp3Player.setAttribute('data',broken[0]+'?'+broken[1]+'?'+newval)
}
Using JQuery but still does not work
var mp3Player = getFlashMovieObject(mymovievarmp3);
var newstring = $("#mp3Player ").data("data");
Try the following code:
IE have issues getting non standard attributes from elements.
Update:
If you are willing to use another library such as
jQueryyou can easily do something likeAnd is going to be crossbrowser for sure.
Update 2
I updated the code and explained a bit. Hope it helps you out!
Update 3
The following code can be used to set value to data: