MrFish Posted February 1, 2013 Share Posted February 1, 2013 var object = document.createElement("object");object.setAttribute("width", 519);object.setAttribute("height", 292);object.setAttribute("id", "video"); var mparam = document.createElement("param");mparam.setAttribute("name", "movie");mparam.setAttribute("value", flashUrl); var fsparam = document.createElement("param");fsparam.setAttribute("name", "allowFullScreen");fsparam.setAttribute("value", "true"); var asaparam = document.createElement("param");asaparam.setAttribute("name", "allowscriptaccess");asaparam.setAttribute("value", "always"); var embed = document.createElement("embed");embed.setAttribute("src", flashUrl);embed.setAttribute("type", "application/x-shockwave-flash");embed.setAttribute("width", "519");embed.setAttribute("height", "292");embed.setAttribute("allowscriptaccess", "always");embed.setAttribute("allowsfullscreen", "true"); object.appendChild(mparam);object.appendChild(fsparam);object.appendChild(asaparam);*** object.appendChild(embed); $("#video").remove();$("#video_main")[0].appendChild(object); This code works in all browsers except for IE8 and lower. It's stopping at the line I marked with three asterisks ( object.appendChild(embed) ). It gives me this error without any other explanation- SCRIPT87: Invalid argument. I don't know why it can't append embed elements. I also tried object.innerHTML += embed.outerHTML but that had an undescrive runtime error. http://www.price-homes.com/Home Link to comment Share on other sites More sharing options...
jeffman Posted February 1, 2013 Share Posted February 1, 2013 I seem to remember having problems with old versions using element tag names as variable names. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 1, 2013 Share Posted February 1, 2013 Since you only require embed for non IE browsers and IE browsers greater than IE8 use if('\v' != 'v'){object.appendChild(embed);} only IE9 and other better browsers will pass the if condition and insert embed Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now