Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / April 2007



Tip: Looking for answers? Try searching our database.

This small piece of code works in Firefox but not in IE 7... why?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SM - 28 Apr 2007 06:02 GMT
Hello,
How hard could it be to create the embeded youtube object in
JavaScript DOM ? ....
I've create the code and it works ok in Firefox but  in IE7 i get an
invalid argument error.

Can someone tell me what im doing wrong?

For reference, this is the embebed youtube video object:
<object width="425" height="350"><param name="movie" value="http://
www.youtube.com/v/dMH0bHeiRNg"></param><param name="wmode"
value="transparent"></param><embed src="http://www.youtube.com/v/
dMH0bHeiRNg" type="application/x-shockwave-flash" wmode="transparent"
width="425" height="350"></embed></object>

This is my attempt to create it using the JavaScript DOM:

function video()
{
var div = document.getElementById("content");   //insert the video in
this div

//create the youtube object
var object1 = document.createElement('object');
object1.setAttribute('width','425');
object1.setAttribute('height','350');

var param1 = ce('param','movie');
param1.setAttribute('value','http://www.youtube.com/v/dMH0bHeiRNg');
object1.appendChild(param1);

var param2 = ce('param','wmode');
param2.setAttribute('value','transparent');
object1.appendChild(param2);

var embed1 = document.createElement('embed');
embed1.setAttribute('width','425');
embed1.setAttribute('height','350');
embed1.setAttribute('wmode','transparent');
embed1.setAttribute('type','application/x-shockwave-flash');
embed1.setAttribute('src','http://www.youtube.com/v/dMH0bHeiRNg');

object1.appendChild(embed1);

div.appendChild(object1);   //insert the video
}

function ce(tag,name)
{
  if (name && window.ActiveXObject)
  {
     element = document.createElement('<'+tag+' name="'+name+'">');
  }
  else
  {
     element = document.createElement(tag);
     element.setAttribute('name',name);
  }

 return element;
}

Why IE7 gives me an error but Firefox not?

Thanks
Marco
shimmyshack - 28 Apr 2007 09:48 GMT
> Hello,
> How hard could it be to create the embeded youtube object in
[quoted text clipped - 63 lines]
> Thanks
> Marco

would UFO be any good to you? - google it for a unobtrusive x-browser
flash embedding script.
pranav.kamkhalia@gmail.com - 30 Apr 2007 02:06 GMT
I am facing the same problem, if you get the solution can you please
email the same at pranav.kamkhalia@gmail.com. Appreciate your help.

> Hello,
> How hard could it be to create the embeded youtube object in
[quoted text clipped - 63 lines]
> Thanks
> Marco
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.