473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

SM
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

Apr 28 '07 #1
2 2048
On Apr 28, 6:02 am, SM <servandomont...@gmail.comwrote:
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
would UFO be any good to you? - google it for a unobtrusive x-browser
flash embedding script.

Apr 28 '07 #2
I am facing the same problem, if you get the solution can you please
email the same at pr**************@gmail.com. Appreciate your help.

On Apr 28, 1:02 am, SM <servandomont...@gmail.comwrote:
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

Apr 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: rick | last post by:
I am new to javascript and would appreciate any help that is offered. The following script does not work in IE (the value (document.quote.qty1.value)is not displayed in the "equiptotal" field)....
2
by: Vincent van Beveren | last post by:
I have the following (seemingly) useless piece of JavaScript <html> <head> <script type="text/javascript"> function frameMe() { s = "document.open();"; s +=...
1
by: Nobody | last post by:
I'm trying to write a class where I need to sort a list of TreeNode objects in a certain way. So I thought I'd use: List<ListNodeData> and then use the Sort method. I have the code working...
6
by: Alan Silver | last post by:
Hello, I'm just taking my first steps at doing layout with CSS, and I'm having a few problems. This could be because I don't really understand what I'm doing yet!! I would really appreciate any...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
5
by: sriram.nandakumar | last post by:
Hi there.. I have this piece of code to basically understand the event model in IE. <html> <head> <title>Events</title> <script> function callMe(){
3
by: Bob | last post by:
I have a small JS function to edit "code". This function works as intended in Firefox, but not IE 6 or Opera 9. I suppose this is an old story, but is there a work around? I have two forms on the...
3
by: SM | last post by:
I'm using simpleXML in PHP and i Can't get this small piece of code to work? Need help I have an XML that looks like this: <?xml version="1.0" encoding="utf-8"?> <VIDEO> <item>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.