Jump to content

IE Cannot Append Embed Element to Object Element


Recommended Posts

 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...