code_junkie

How do I change/replace a flash object with jquery or pure javascript?

Nov 11th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. $(enclosing div).html('');
  2. $(enclosing div).html(<object>My New Object</object>);
  3.  
  4. $('#mydiv').empty();
  5.  
  6. function removeObjectInIE(el) {
  7. var jbo = (typeof(el) == "string" ? getElementById(el) : el);
  8. if (jbo) {
  9. for (var i in jbo) {
  10. if (typeof jbo[i] == "function") {
  11. jbo[i] = null;
  12. }
  13. }
  14. jbo.parentNode.removeChild(jbo);
  15. }
  16. }
  17.  
  18. function removeSWF(id) {
  19. var obj = (typeof(id) == "string" ? getElementById(id) : id);
  20. if(obj){
  21. if (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED") {
  22. if (ua.ie && ua.win) {
  23. if (obj.readyState == 4) {
  24. removeObjectInIE(id);
  25. }
  26. else {
  27. $(document).ready(function() { removeObjectInIE(id); });
  28. }
  29. }
  30. else {
  31. obj.parentNode.removeChild(obj);
  32. }
  33. }else if(obj.childNodes && obj.childNodes.length > 0){
  34. for(var i=0;i<obj.childNodes.length;i++){
  35. removeSWF(obj.childNodes[i]);
  36. }
  37. }
  38. }
  39. }
Add Comment
Please, Sign In to add comment